stackprof 0.2.23 → 0.2.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/stackprof +7 -8
- data/ext/stackprof/stackprof.c +16 -0
- data/lib/stackprof.rb +6 -1
- data/stackprof.gemspec +1 -1
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 90e33127951d53147b6a65704446ec812999df9525d868865029ee1c7450445d
|
4
|
+
data.tar.gz: 19a5f104482f355cb1957b71b18b15b9ca9bb981cfcc109688366e53704c5711
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17610238200852f97afcc730efd9171c46c3a001ff7d5b82cb65fc92f96d9d2b206474bcecc7eeee1981365d2a07fd4dad460edc54a8bc9c8b1e6c7412f7cde3
|
7
|
+
data.tar.gz: 35cc1394b526edd0782468b06d54f66eb1ff10e5741becf486f68f0b141511fad9db622816004a4ae2e1a59cff048abe2d5697848eff127640663e9246f33cca
|
data/bin/stackprof
CHANGED
@@ -2,13 +2,15 @@
|
|
2
2
|
require 'optparse'
|
3
3
|
require 'stackprof'
|
4
4
|
|
5
|
+
banner = <<-END
|
6
|
+
Usage: stackprof run [--mode=MODE|--out=FILE|--interval=INTERVAL|--format=FORMAT] -- COMMAND
|
7
|
+
Usage: stackprof [file.dump]+ [--text|--method=NAME|--callgrind|--graphviz]
|
8
|
+
END
|
9
|
+
|
5
10
|
if ARGV.first == "run"
|
6
11
|
ARGV.shift
|
7
12
|
env = {}
|
8
|
-
parser = OptionParser.new(
|
9
|
-
o.banner = "Usage: stackprof run [--mode=MODE|--out=FILE|--interval=INTERVAL|--format=FORMAT] -- COMMAND"
|
10
|
-
o.banner = "Usage: stackprof [file.dump]+ [--text|--method=NAME|--callgrind|--graphviz]"
|
11
|
-
|
13
|
+
parser = OptionParser.new(banner) do |o|
|
12
14
|
o.on('--mode [MODE]', String, 'Mode of sampling: cpu, wall, object, default to wall') do |mode|
|
13
15
|
env["STACKPROF_MODE"] = mode
|
14
16
|
end
|
@@ -37,10 +39,7 @@ if ARGV.first == "run"
|
|
37
39
|
else
|
38
40
|
options = {}
|
39
41
|
|
40
|
-
parser = OptionParser.new(
|
41
|
-
o.banner = "Usage: stackprof run [--mode|--out|--interval] -- COMMAND"
|
42
|
-
o.banner = "Usage: stackprof [file.dump]+ [--text|--method=NAME|--callgrind|--graphviz]"
|
43
|
-
|
42
|
+
parser = OptionParser.new(banner) do |o|
|
44
43
|
o.on('--text', 'Text summary per method (default)'){ options[:format] = :text }
|
45
44
|
o.on('--json', 'JSON output (use with web viewers)'){ options[:format] = :json }
|
46
45
|
o.on('--files', 'List of files'){ |f| options[:format] = :files }
|
data/ext/stackprof/stackprof.c
CHANGED
@@ -12,6 +12,7 @@
|
|
12
12
|
#include <ruby/st.h>
|
13
13
|
#include <ruby/io.h>
|
14
14
|
#include <ruby/intern.h>
|
15
|
+
#include <ruby/vm.h>
|
15
16
|
#include <signal.h>
|
16
17
|
#include <sys/time.h>
|
17
18
|
#include <time.h>
|
@@ -32,6 +33,7 @@ static const char *fake_frame_cstrs[] = {
|
|
32
33
|
};
|
33
34
|
|
34
35
|
static int stackprof_use_postponed_job = 1;
|
36
|
+
static int ruby_vm_running = 0;
|
35
37
|
|
36
38
|
#define TOTAL_FAKE_FRAMES (sizeof(fake_frame_cstrs) / sizeof(char *))
|
37
39
|
|
@@ -725,6 +727,11 @@ stackprof_signal_handler(int sig, siginfo_t *sinfo, void *ucontext)
|
|
725
727
|
|
726
728
|
if (!_stackprof.running) return;
|
727
729
|
|
730
|
+
// There's a possibility that the signal handler is invoked *after* the Ruby
|
731
|
+
// VM has been shut down (e.g. after ruby_cleanup(0)). In this case, things
|
732
|
+
// that rely on global VM state (e.g. rb_during_gc) will segfault.
|
733
|
+
if (!ruby_vm_running) return;
|
734
|
+
|
728
735
|
if (_stackprof.mode == sym_wall) {
|
729
736
|
// In "wall" mode, the SIGALRM signal will arrive at an arbitrary thread.
|
730
737
|
// In order to provide more useful results, especially under threaded web
|
@@ -845,6 +852,12 @@ stackprof_use_postponed_job_l(VALUE self)
|
|
845
852
|
return Qnil;
|
846
853
|
}
|
847
854
|
|
855
|
+
static void
|
856
|
+
stackprof_at_exit(ruby_vm_t* vm)
|
857
|
+
{
|
858
|
+
ruby_vm_running = 0;
|
859
|
+
}
|
860
|
+
|
848
861
|
void
|
849
862
|
Init_stackprof(void)
|
850
863
|
{
|
@@ -855,6 +868,9 @@ Init_stackprof(void)
|
|
855
868
|
*/
|
856
869
|
stackprof_use_postponed_job = RUBY_API_VERSION_MAJOR < 3;
|
857
870
|
|
871
|
+
ruby_vm_running = 1;
|
872
|
+
ruby_vm_at_exit(stackprof_at_exit);
|
873
|
+
|
858
874
|
#define S(name) sym_##name = ID2SYM(rb_intern(#name));
|
859
875
|
S(object);
|
860
876
|
S(custom);
|
data/lib/stackprof.rb
CHANGED
@@ -6,10 +6,15 @@ end
|
|
6
6
|
|
7
7
|
if defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?
|
8
8
|
StackProf.use_postponed_job!
|
9
|
+
elsif RUBY_VERSION == "3.2.0"
|
10
|
+
# 3.2.0 crash is the signal is received at the wrong time.
|
11
|
+
# Fixed in https://github.com/ruby/ruby/pull/7116
|
12
|
+
# The fix is backported in 3.2.1: https://bugs.ruby-lang.org/issues/19336
|
13
|
+
StackProf.use_postponed_job!
|
9
14
|
end
|
10
15
|
|
11
16
|
module StackProf
|
12
|
-
VERSION = '0.2.
|
17
|
+
VERSION = '0.2.24'
|
13
18
|
end
|
14
19
|
|
15
20
|
StackProf.autoload :Report, "stackprof/report.rb"
|
data/stackprof.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stackprof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Aman Gupta
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-03-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake-compiler
|
@@ -99,10 +99,10 @@ licenses:
|
|
99
99
|
- MIT
|
100
100
|
metadata:
|
101
101
|
bug_tracker_uri: https://github.com/tmm1/stackprof/issues
|
102
|
-
changelog_uri: https://github.com/tmm1/stackprof/blob/v0.2.
|
103
|
-
documentation_uri: https://www.rubydoc.info/gems/stackprof/0.2.
|
104
|
-
source_code_uri: https://github.com/tmm1/stackprof/tree/v0.2.
|
105
|
-
post_install_message:
|
102
|
+
changelog_uri: https://github.com/tmm1/stackprof/blob/v0.2.24/CHANGELOG.md
|
103
|
+
documentation_uri: https://www.rubydoc.info/gems/stackprof/0.2.24
|
104
|
+
source_code_uri: https://github.com/tmm1/stackprof/tree/v0.2.24
|
105
|
+
post_install_message:
|
106
106
|
rdoc_options: []
|
107
107
|
require_paths:
|
108
108
|
- lib
|
@@ -117,8 +117,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
requirements: []
|
120
|
-
rubygems_version: 3.3.
|
121
|
-
signing_key:
|
120
|
+
rubygems_version: 3.0.3.1
|
121
|
+
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: sampling callstack-profiler for ruby 2.2+
|
124
124
|
test_files: []
|