Module: Pyroscope

Defined in:
lib/pyroscope.rb,
lib/pyroscope/version.rb,
ext/pyroscope/pyroscope.c

Defined Under Namespace

Classes: Config

Constant Summary collapse

VERSION =
"0.0.14".freeze

Class Method Summary collapse

Class Method Details

._change_name(appName, pid) ⇒ Object



35
36
37
38
39
40
41
42
43
# File 'ext/pyroscope/pyroscope.c', line 35

static VALUE
pyroscope_change_name(VALUE self, VALUE appName, VALUE pid) {
  VALUE r_appName = StringValue(appName);
  char *c_appName = RSTRING_PTR(r_appName);
  int c_pid = FIX2INT(pid);

  int res = ChangeName(c_appName, c_pid);
  return INT2FIX(res);
}

._start(appName, pid, serverAddress) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'ext/pyroscope/pyroscope.c', line 13

static VALUE
pyroscope_start(VALUE self, VALUE appName, VALUE pid, VALUE serverAddress) {
  VALUE r_appName = StringValue(appName);
  char *c_appName = RSTRING_PTR(r_appName);

  int c_pid = FIX2INT(pid);

  VALUE r_serverAddress = StringValue(serverAddress);
  char *c_serverAddress = RSTRING_PTR(r_serverAddress);

  int res = Start(c_appName, c_pid, "rbspy", c_serverAddress);

  return INT2FIX(res);
}

._stop(pid) ⇒ Object



28
29
30
31
32
33
# File 'ext/pyroscope/pyroscope.c', line 28

static VALUE
pyroscope_stop(VALUE self, VALUE pid) {
  int c_pid = FIX2INT(pid);
  int res = Stop(c_pid);
  return INT2FIX(res);
}

.change_name(new_name) ⇒ Object



21
22
23
# File 'lib/pyroscope.rb', line 21

def self.change_name(new_name)
  _change_name(new_name, Process.pid)
end

.configure {|@configuration| ... } ⇒ Object

Yields:

  • (@configuration)


7
8
9
10
11
12
13
14
15
# File 'lib/pyroscope.rb', line 7

def self.configure
  @configuration = Config.new
  yield @configuration
  _start(
    @configuration.app_name,
    Process.pid,
    @configuration.server_address,
  )
end

.stopObject



17
18
19
# File 'lib/pyroscope.rb', line 17

def self.stop
  _stop(Process.pid)
end