pyroscope 0.0.10 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -0
- data/Rakefile +13 -1
- data/ext/pyroscope/extconf.rb +17 -14
- data/ext/pyroscope/lib/libpyroscope.rbspy.a +0 -0
- data/ext/pyroscope/lib/librustdeps.a +0 -0
- data/ext/pyroscope/pyroscope.c +6 -4
- data/lib/pyroscope.rb +1 -1
- data/lib/pyroscope/version.rb +1 -1
- data/test.rb +38 -8
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36bb83e12718ebaaceda2abd73fe6aa04b7118186a2532a9a84334a8d9ea78a9
|
4
|
+
data.tar.gz: b7c5269520ffb6692ef147d781f7ebc1d1ee71f0810367ab8e9dd39149a5043a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50d07468d065727335c16c76fec8365f79aee6e10f924dfc8613b2bc2c8307a71db6586bd5efe15391288e86e1132c2bcdfd58b75d3972c9a519080bf4c63306
|
7
|
+
data.tar.gz: afd0327de15581b6cb6a48ea34472ce9c3b7ceeb1b39c197ba62b33e4b6fb0125d603d2595fe34a0757e0bb4b60b059a723a9d5fa787097753fd311269c56f26
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -42,7 +42,19 @@ task :build => [:clean, :compile]
|
|
42
42
|
task :default => [:build, :spec]
|
43
43
|
|
44
44
|
task :test do
|
45
|
-
system "
|
45
|
+
system "rsync -a /home/dmitry/rbspy/ /home/dmitry/pyroscope/third_party/local-clones/rbspy"
|
46
|
+
# system "cd ../pyroscope && DOCKER_BUILDKIT=1 docker build -f Dockerfile.static-libs --output type=local,dest=out ." if RUBY_PLATFORM.include?("linux")
|
47
|
+
system "cd ../pyroscope && rm out/*.a"
|
48
|
+
system "cd ../pyroscope && ENABLED_SPIES=rbspy make build-rust-dependencies"
|
49
|
+
system "cd ../pyroscope && make build-rbspy-static-library"
|
50
|
+
system "cd ../pyroscope && cp third_party/rustdeps/target/x86_64-unknown-linux-gnu/release/librustdeps.a ./out/librustdeps.a"
|
51
|
+
|
52
|
+
system "PYROSCOPE_RUBY_LOCAL=1 rake build && PYROSCOPE_RUBY_LOCAL=1 sudo -E gem install pkg/pyroscope-#{Pyroscope::VERSION}.gem && sudo -E ruby test.rb"
|
53
|
+
end
|
54
|
+
|
55
|
+
task :test_exec do
|
56
|
+
# system "cd ../pyroscope && DOCKER_BUILDKIT=1 docker build -f Dockerfile.static-libs --output type=local,dest=out ." if RUBY_PLATFORM.include?("linux")
|
57
|
+
system "sudo -E pyroscope exec ruby test.rb"
|
46
58
|
end
|
47
59
|
|
48
60
|
task :publish do
|
data/ext/pyroscope/extconf.rb
CHANGED
@@ -9,7 +9,7 @@ HEADER_DIRS = [INCLUDEDIR]
|
|
9
9
|
|
10
10
|
LIB_DIRS = [LIBDIR, File.expand_path(File.join(File.dirname(__FILE__), "lib"))]
|
11
11
|
|
12
|
-
COMMIT = "
|
12
|
+
COMMIT = "bfb9a32"
|
13
13
|
|
14
14
|
# TODO: this is not very accurate, but it works for now
|
15
15
|
OS = RUBY_PLATFORM.include?("darwin") ? "mac" : "linux"
|
@@ -19,24 +19,27 @@ PREFIX = "/static-libs/#{COMMIT}/#{OS}-#{ARCH}"
|
|
19
19
|
|
20
20
|
ROOT = File.expand_path("..", __FILE__)
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
22
|
+
if ENV["PYROSCOPE_RUBY_LOCAL"]
|
23
|
+
puts "PYROSCOPE_RUBY_LOCAL yes"
|
24
|
+
system "cp #{ENV["HOME"]}/pyroscope/out/libpyroscope.rbspy.a #{File.join(ROOT, "lib/libpyroscope.rbspy.a")}"
|
25
|
+
system "cp #{ENV["HOME"]}/pyroscope/out/librustdeps.a #{File.join(ROOT, "lib/librustdeps.a")}"
|
26
|
+
else
|
27
|
+
Net::HTTP.start("dl.pyroscope.io", 443, :use_ssl => true) do |http|
|
28
|
+
res1 = http.get(PREFIX+"/libpyroscope.rbspy.a")
|
29
|
+
raise "HTTP error: #{res1.code}" unless res1.code == "200"
|
30
|
+
lib1 = res1.body
|
31
|
+
File.binwrite(File.join(ROOT, "lib/libpyroscope.rbspy.a"), lib1)
|
32
|
+
|
33
|
+
res2 = http.get(PREFIX+"/librustdeps.a")
|
34
|
+
raise "HTTP error: #{res2.code}" unless res2.code == "200"
|
35
|
+
lib2 = res2.body
|
36
|
+
File.binwrite(File.join(ROOT, "lib/librustdeps.a"), lib2)
|
37
|
+
end
|
32
38
|
end
|
33
39
|
|
34
40
|
# TODO: figure out how to fix this bug
|
35
41
|
system "strip --strip-debug #{File.join(ROOT, "lib/libpyroscope.rbspy.a")}"
|
36
42
|
|
37
|
-
# system "cp /Users/dmitry/Dev/ps/pyroscope/out/libpyroscope.rbspy.a #{File.join(ROOT, "lib/libpyroscope.rbspy.a")}"
|
38
|
-
# system "cp /Users/dmitry/Dev/ps/pyroscope/third_party/rustdeps/target/release/librustdeps.a #{File.join(ROOT, "lib/librustdeps.a")}"
|
39
|
-
|
40
43
|
dir_config('pyroscope', HEADER_DIRS, LIB_DIRS)
|
41
44
|
|
42
45
|
libs = ['-lpyroscope.rbspy', '-lrustdeps']
|
Binary file
|
Binary file
|
data/ext/pyroscope/pyroscope.c
CHANGED
@@ -8,7 +8,7 @@ static VALUE rb_Pyroscope;
|
|
8
8
|
|
9
9
|
int Start(char*, int, char*, char*);
|
10
10
|
int Stop(int);
|
11
|
-
int ChangeName(char
|
11
|
+
int ChangeName(char*, int);
|
12
12
|
|
13
13
|
static VALUE
|
14
14
|
pyroscope_start(VALUE self, VALUE appName, VALUE pid, VALUE serverAddress) {
|
@@ -33,10 +33,12 @@ pyroscope_stop(VALUE self, VALUE pid) {
|
|
33
33
|
}
|
34
34
|
|
35
35
|
static VALUE
|
36
|
-
pyroscope_change_name(VALUE self, VALUE appName) {
|
36
|
+
pyroscope_change_name(VALUE self, VALUE appName, VALUE pid) {
|
37
37
|
VALUE r_appName = StringValue(appName);
|
38
38
|
char *c_appName = RSTRING_PTR(r_appName);
|
39
|
-
int
|
39
|
+
int c_pid = FIX2INT(pid);
|
40
|
+
|
41
|
+
int res = ChangeName(c_appName, c_pid);
|
40
42
|
return INT2FIX(res);
|
41
43
|
}
|
42
44
|
|
@@ -45,5 +47,5 @@ Init_pyroscope_c() {
|
|
45
47
|
rb_Pyroscope = rb_define_module("Pyroscope");
|
46
48
|
rb_define_module_function(rb_Pyroscope, "_start", pyroscope_start, 3);
|
47
49
|
rb_define_module_function(rb_Pyroscope, "_stop", pyroscope_stop, 1);
|
48
|
-
rb_define_module_function(rb_Pyroscope, "_change_name", pyroscope_change_name,
|
50
|
+
rb_define_module_function(rb_Pyroscope, "_change_name", pyroscope_change_name, 2);
|
49
51
|
}
|
data/lib/pyroscope.rb
CHANGED
data/lib/pyroscope/version.rb
CHANGED
data/test.rb
CHANGED
@@ -3,19 +3,49 @@ require 'pyroscope'
|
|
3
3
|
puts "prestart #{Process.pid}"
|
4
4
|
|
5
5
|
Pyroscope.configure do |config|
|
6
|
-
config.app_name = "test.app
|
6
|
+
config.app_name = "test.ruby.app{}"
|
7
7
|
config.server_address = "http://localhost:4040/"
|
8
8
|
end
|
9
9
|
|
10
10
|
puts "start"
|
11
|
-
|
11
|
+
iteration=0
|
12
12
|
st = Time.new
|
13
|
+
|
14
|
+
def work(n)
|
15
|
+
i = 0
|
16
|
+
while i < n
|
17
|
+
i += 1
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def job_0
|
22
|
+
work(rand()*1_000_000)
|
23
|
+
end
|
24
|
+
|
25
|
+
def job_1
|
26
|
+
work(rand()*2_000_000)
|
27
|
+
end
|
28
|
+
|
29
|
+
def sleep_job
|
30
|
+
sleep(rand()*10)
|
31
|
+
end
|
32
|
+
|
33
|
+
|
13
34
|
while true
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
35
|
+
iteration+=1
|
36
|
+
|
37
|
+
r = rand
|
38
|
+
if r < 0.1
|
39
|
+
sleep_job
|
40
|
+
elsif r < 0.5
|
41
|
+
puts(" * test.ruby.app{job=0}")
|
42
|
+
Pyroscope.change_name("test.ruby.app{job=0}")
|
43
|
+
job_0
|
44
|
+
Pyroscope.change_name("test.ruby.app{}")
|
45
|
+
else
|
46
|
+
puts(" * test.ruby.app{job=1}")
|
47
|
+
Pyroscope.change_name("test.ruby.app{job=1}")
|
48
|
+
job_1
|
49
|
+
Pyroscope.change_name("test.ruby.app{}")
|
20
50
|
end
|
21
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pyroscope
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pyroscope Team
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -104,7 +104,7 @@ homepage: http://rubygems.org/gems/pyroscope
|
|
104
104
|
licenses:
|
105
105
|
- Apache-2.0
|
106
106
|
metadata: {}
|
107
|
-
post_install_message:
|
107
|
+
post_install_message:
|
108
108
|
rdoc_options: []
|
109
109
|
require_paths:
|
110
110
|
- lib
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
requirements: []
|
123
123
|
rubygems_version: 3.2.15
|
124
|
-
signing_key:
|
124
|
+
signing_key:
|
125
125
|
specification_version: 4
|
126
126
|
summary: pyroscope
|
127
127
|
test_files: []
|