pyroscope 0.1.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +202 -0
- data/README.md +56 -2
- data/elflib/rbspy/manylinux.sh +23 -0
- data/elflib/rbspy/pyproject.toml +7 -0
- data/{ext/pyroscope/lib/.gitkeep → elflib/rbspy/rbspy/__init__.py} +0 -0
- data/elflib/rbspy/setup.cfg +22 -0
- data/elflib/rbspy/setup.py +46 -0
- data/elflib/thread_id/manylinux.sh +23 -0
- data/elflib/thread_id/pyproject.toml +7 -0
- data/elflib/thread_id/setup.cfg +22 -0
- data/elflib/thread_id/setup.py +46 -0
- data/elflib/thread_id/thread_id/__init__.py +0 -0
- data/ext/rbspy/Cargo.toml +27 -0
- data/ext/rbspy/Rakefile +164 -0
- data/ext/rbspy/build.rs +12 -0
- data/ext/rbspy/cbindgen.toml +22 -0
- data/ext/rbspy/extconf.rb +11 -0
- data/ext/rbspy/src/lib.rs +168 -0
- data/ext/thread_id/Cargo.toml +20 -0
- data/ext/thread_id/Rakefile +163 -0
- data/ext/thread_id/build.rs +12 -0
- data/ext/thread_id/cbindgen.toml +22 -0
- data/ext/thread_id/extconf.rb +11 -0
- data/ext/thread_id/src/lib.rs +4 -0
- data/lib/pyroscope/version.rb +1 -1
- data/lib/pyroscope.rb +74 -32
- data/pyroscope.gemspec +28 -23
- data/scripts/docker.sh +16 -0
- metadata +43 -58
- data/.gitignore +0 -7
- data/Gemfile +0 -4
- data/Gemfile.lock +0 -48
- data/Rakefile +0 -56
- data/ext/pyroscope/Makefile.example +0 -265
- data/ext/pyroscope/extconf.rb +0 -79
- data/ext/pyroscope/lib/libpyroscope.rbspy.a +0 -0
- data/ext/pyroscope/lib/libpyroscope.rbspy.combo.a +0 -0
- data/ext/pyroscope/lib/librustdeps.a +0 -0
- data/ext/pyroscope/pyroscope.c +0 -87
- data/test.rb +0 -32
data/ext/pyroscope/pyroscope.c
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
#include <stdlib.h>
|
2
|
-
#include <ruby.h>
|
3
|
-
|
4
|
-
static VALUE rb_Pyroscope;
|
5
|
-
|
6
|
-
#include <stdio.h>
|
7
|
-
#include <string.h>
|
8
|
-
|
9
|
-
int Start(char*, char*, char*, char*, int, int, char*);
|
10
|
-
int Stop();
|
11
|
-
int ChangeName(char*);
|
12
|
-
int SetTag(char*, char*);
|
13
|
-
int TestLogger();
|
14
|
-
char* BuildSummary();
|
15
|
-
|
16
|
-
static VALUE
|
17
|
-
pyroscope_start(VALUE self, VALUE appName, VALUE serverAddress, VALUE authToken, VALUE sampleRate, VALUE withSubprocesses, VALUE logLevel) {
|
18
|
-
VALUE r_appName = StringValue(appName);
|
19
|
-
char *c_appName = RSTRING_PTR(r_appName);
|
20
|
-
|
21
|
-
int c_sampleRate = FIX2INT(sampleRate);
|
22
|
-
int c_withSubprocesses = FIX2INT(withSubprocesses);
|
23
|
-
|
24
|
-
VALUE r_serverAddress = StringValue(serverAddress);
|
25
|
-
char *c_serverAddress = RSTRING_PTR(r_serverAddress);
|
26
|
-
|
27
|
-
VALUE r_authToken = StringValue(authToken);
|
28
|
-
char *c_authToken = RSTRING_PTR(r_authToken);
|
29
|
-
|
30
|
-
VALUE r_logLevel = StringValue(logLevel);
|
31
|
-
char *c_logLevel = RSTRING_PTR(r_logLevel);
|
32
|
-
|
33
|
-
int res = Start(c_appName, "rbspy", c_serverAddress, c_authToken, c_sampleRate, c_withSubprocesses, c_logLevel);
|
34
|
-
|
35
|
-
return INT2FIX(res);
|
36
|
-
}
|
37
|
-
|
38
|
-
static VALUE
|
39
|
-
pyroscope_stop(VALUE self) {
|
40
|
-
int res = Stop();
|
41
|
-
return INT2FIX(res);
|
42
|
-
}
|
43
|
-
|
44
|
-
static VALUE
|
45
|
-
pyroscope_change_name(VALUE self, VALUE appName) {
|
46
|
-
VALUE r_appName = StringValue(appName);
|
47
|
-
char *c_appName = RSTRING_PTR(r_appName);
|
48
|
-
|
49
|
-
int res = ChangeName(c_appName);
|
50
|
-
return INT2FIX(res);
|
51
|
-
}
|
52
|
-
|
53
|
-
static VALUE
|
54
|
-
pyroscope_set_tag(VALUE self, VALUE key, VALUE val) {
|
55
|
-
VALUE r_key = StringValue(key);
|
56
|
-
char *c_key = RSTRING_PTR(r_key);
|
57
|
-
VALUE r_val = StringValue(val);
|
58
|
-
char *c_val = RSTRING_PTR(r_val);
|
59
|
-
|
60
|
-
int res = SetTag(c_key, c_val);
|
61
|
-
return INT2FIX(res);
|
62
|
-
}
|
63
|
-
|
64
|
-
static VALUE
|
65
|
-
pyroscope_test_logger(VALUE self) {
|
66
|
-
int res = TestLogger();
|
67
|
-
return INT2FIX(res);
|
68
|
-
}
|
69
|
-
|
70
|
-
static VALUE
|
71
|
-
pyroscope_build_summary(VALUE self) {
|
72
|
-
char *c_summary = BuildSummary();
|
73
|
-
VALUE r_summary = rb_str_new_cstr(c_summary);
|
74
|
-
free(c_summary);
|
75
|
-
return r_summary;
|
76
|
-
}
|
77
|
-
|
78
|
-
void
|
79
|
-
Init_pyroscope_c() {
|
80
|
-
rb_Pyroscope = rb_define_module("Pyroscope");
|
81
|
-
rb_define_module_function(rb_Pyroscope, "_start", pyroscope_start, 6);
|
82
|
-
rb_define_module_function(rb_Pyroscope, "_stop", pyroscope_stop, 0);
|
83
|
-
rb_define_module_function(rb_Pyroscope, "_change_name", pyroscope_change_name, 1);
|
84
|
-
rb_define_module_function(rb_Pyroscope, "_set_tag", pyroscope_set_tag, 2);
|
85
|
-
rb_define_module_function(rb_Pyroscope, "_test_logger", pyroscope_test_logger, 0);
|
86
|
-
rb_define_module_function(rb_Pyroscope, "_build_summary", pyroscope_build_summary, 0);
|
87
|
-
}
|
data/test.rb
DELETED
@@ -1,32 +0,0 @@
|
|
1
|
-
require 'pyroscope'
|
2
|
-
|
3
|
-
puts "prestart #{Process.pid}"
|
4
|
-
|
5
|
-
Pyroscope.configure do |config|
|
6
|
-
config.app_name = "test.ruby.app{}"
|
7
|
-
config.server_address = "http://localhost:4040/"
|
8
|
-
end
|
9
|
-
|
10
|
-
def work(n)
|
11
|
-
i = 0
|
12
|
-
while i < n
|
13
|
-
i += 1
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def fast_function
|
18
|
-
Pyroscope.tag_wrapper({ "function" => "fast"}) do
|
19
|
-
work(20_000)
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
def slow_function
|
24
|
-
Pyroscope.tag({ "function" => "slow"})
|
25
|
-
work(80_000)
|
26
|
-
Pyroscope.remove_tags("function")
|
27
|
-
end
|
28
|
-
|
29
|
-
while true
|
30
|
-
fast_function
|
31
|
-
slow_function
|
32
|
-
end
|