stackprof 0.2.22 → 0.2.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/stackprof +9 -9
- data/ext/stackprof/stackprof.c +19 -1
- data/lib/stackprof.rb +1 -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: db2506be248e74ed4aefacbb3b7adc4936c88b1acb3517fde5510a225704b6bf
|
4
|
+
data.tar.gz: 55aaefff3de2d6887cb9a861eb615faa85e48411eeadf778990bc1439e7c456e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e761d5f7da7687ecb51ecc493c3dc4ff8e86798b57cd65c429b90e29e4021827df58525b5ddd2d21d597cba4a31e251909daa33d518157d63c53e74944784fde
|
7
|
+
data.tar.gz: a8c9da37e92aa2bcc64b2532367f749e5568cfa4e02758dca80d3d3f1b4f399b860dd215f880cea814356d50766103dc684f0192a04660075b5be6e43a7db121
|
data/bin/stackprof
CHANGED
@@ -6,27 +6,27 @@ if ARGV.first == "run"
|
|
6
6
|
ARGV.shift
|
7
7
|
env = {}
|
8
8
|
parser = OptionParser.new(ARGV) do |o|
|
9
|
-
o.banner = "Usage: stackprof run [--mode|--out|--interval] -- COMMAND"
|
9
|
+
o.banner = "Usage: stackprof run [--mode=MODE|--out=FILE|--interval=INTERVAL|--format=FORMAT] -- COMMAND"
|
10
10
|
o.banner = "Usage: stackprof [file.dump]+ [--text|--method=NAME|--callgrind|--graphviz]"
|
11
11
|
|
12
|
-
o.on('--mode', 'Mode of sampling: cpu, wall, object, default to wall') do |mode|
|
12
|
+
o.on('--mode [MODE]', String, 'Mode of sampling: cpu, wall, object, default to wall') do |mode|
|
13
13
|
env["STACKPROF_MODE"] = mode
|
14
14
|
end
|
15
15
|
|
16
|
-
o.on('--out', 'The target file, which will be overwritten. Defaults to a random temporary file') do |out|
|
16
|
+
o.on('--out [FILENAME]', String, 'The target file, which will be overwritten. Defaults to a random temporary file') do |out|
|
17
17
|
env['STACKPROF_OUT'] = out
|
18
18
|
end
|
19
19
|
|
20
|
-
o.on('--interval', 'Mode-relative sample rate') do |interval|
|
21
|
-
env['STACKPROF_INTERVAL'] =
|
20
|
+
o.on('--interval [MILLISECONDS]', Integer, 'Mode-relative sample rate') do |interval|
|
21
|
+
env['STACKPROF_INTERVAL'] = interval.to_s
|
22
22
|
end
|
23
23
|
|
24
|
-
o.on('--raw', 'collects the extra data required by the --flamegraph and --stackcollapse report types') do
|
25
|
-
env['STACKPROF_RAW'] =
|
24
|
+
o.on('--raw', 'collects the extra data required by the --flamegraph and --stackcollapse report types') do |raw|
|
25
|
+
env['STACKPROF_RAW'] = raw.to_s
|
26
26
|
end
|
27
27
|
|
28
|
-
o.on('--ignore-gc', 'Ignore garbage collection frames') do
|
29
|
-
env['STACKPROF_IGNORE_GC'] =
|
28
|
+
o.on('--ignore-gc', 'Ignore garbage collection frames') do |gc|
|
29
|
+
env['STACKPROF_IGNORE_GC'] = gc.to_s
|
30
30
|
end
|
31
31
|
end
|
32
32
|
parser.parse!
|
data/ext/stackprof/stackprof.c
CHANGED
@@ -125,6 +125,8 @@ static struct {
|
|
125
125
|
sample_time_t buffer_time;
|
126
126
|
VALUE frames_buffer[BUF_SIZE];
|
127
127
|
int lines_buffer[BUF_SIZE];
|
128
|
+
|
129
|
+
pthread_t target_thread;
|
128
130
|
} _stackprof;
|
129
131
|
|
130
132
|
static VALUE sym_object, sym_wall, sym_cpu, sym_custom, sym_name, sym_file, sym_line;
|
@@ -219,6 +221,7 @@ stackprof_start(int argc, VALUE *argv, VALUE self)
|
|
219
221
|
_stackprof.ignore_gc = ignore_gc;
|
220
222
|
_stackprof.metadata = metadata;
|
221
223
|
_stackprof.out = out;
|
224
|
+
_stackprof.target_thread = pthread_self();
|
222
225
|
|
223
226
|
if (raw) {
|
224
227
|
capture_timestamp(&_stackprof.last_sample_at);
|
@@ -721,7 +724,22 @@ stackprof_signal_handler(int sig, siginfo_t *sinfo, void *ucontext)
|
|
721
724
|
_stackprof.overall_signals++;
|
722
725
|
|
723
726
|
if (!_stackprof.running) return;
|
724
|
-
|
727
|
+
|
728
|
+
if (_stackprof.mode == sym_wall) {
|
729
|
+
// In "wall" mode, the SIGALRM signal will arrive at an arbitrary thread.
|
730
|
+
// In order to provide more useful results, especially under threaded web
|
731
|
+
// servers, we want to forward this signal to the original thread
|
732
|
+
// StackProf was started from.
|
733
|
+
// According to POSIX.1-2008 TC1 pthread_kill and pthread_self should be
|
734
|
+
// async-signal-safe.
|
735
|
+
if (pthread_self() != _stackprof.target_thread) {
|
736
|
+
pthread_kill(_stackprof.target_thread, sig);
|
737
|
+
return;
|
738
|
+
}
|
739
|
+
} else {
|
740
|
+
if (!ruby_native_thread_p()) return;
|
741
|
+
}
|
742
|
+
|
725
743
|
if (pthread_mutex_trylock(&lock)) return;
|
726
744
|
|
727
745
|
if (!_stackprof.ignore_gc && rb_during_gc()) {
|
data/lib/stackprof.rb
CHANGED
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.23
|
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: 2022-
|
11
|
+
date: 2022-11-29 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.23/CHANGELOG.md
|
103
|
+
documentation_uri: https://www.rubydoc.info/gems/stackprof/0.2.23
|
104
|
+
source_code_uri: https://github.com/tmm1/stackprof/tree/v0.2.23
|
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.
|
121
|
-
signing_key:
|
120
|
+
rubygems_version: 3.3.23
|
121
|
+
signing_key:
|
122
122
|
specification_version: 4
|
123
123
|
summary: sampling callstack-profiler for ruby 2.2+
|
124
124
|
test_files: []
|