pf2 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +31 -2
- data/Cargo.lock +186 -17
- data/Cargo.toml +1 -1
- data/README.md +18 -6
- data/Rakefile +8 -0
- data/crates/backtrace-sys2/.gitignore +1 -0
- data/crates/backtrace-sys2/Cargo.toml +9 -0
- data/crates/backtrace-sys2/build.rs +48 -0
- data/crates/backtrace-sys2/src/lib.rs +5 -0
- data/crates/backtrace-sys2/src/libbacktrace/.gitignore +15 -0
- data/crates/backtrace-sys2/src/libbacktrace/Isaac.Newton-Opticks.txt +9286 -0
- data/crates/backtrace-sys2/src/libbacktrace/LICENSE +29 -0
- data/crates/backtrace-sys2/src/libbacktrace/Makefile.am +623 -0
- data/crates/backtrace-sys2/src/libbacktrace/Makefile.in +2666 -0
- data/crates/backtrace-sys2/src/libbacktrace/README.md +36 -0
- data/crates/backtrace-sys2/src/libbacktrace/aclocal.m4 +864 -0
- data/crates/backtrace-sys2/src/libbacktrace/alloc.c +167 -0
- data/crates/backtrace-sys2/src/libbacktrace/allocfail.c +136 -0
- data/crates/backtrace-sys2/src/libbacktrace/allocfail.sh +104 -0
- data/crates/backtrace-sys2/src/libbacktrace/atomic.c +113 -0
- data/crates/backtrace-sys2/src/libbacktrace/backtrace-supported.h.in +66 -0
- data/crates/backtrace-sys2/src/libbacktrace/backtrace.c +129 -0
- data/crates/backtrace-sys2/src/libbacktrace/backtrace.h +189 -0
- data/crates/backtrace-sys2/src/libbacktrace/btest.c +501 -0
- data/crates/backtrace-sys2/src/libbacktrace/compile +348 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/enable.m4 +38 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/lead-dot.m4 +31 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/libtool.m4 +7436 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/ltoptions.m4 +369 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/ltsugar.m4 +123 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/ltversion.m4 +23 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/lt~obsolete.m4 +98 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/multi.m4 +68 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/override.m4 +117 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/unwind_ipinfo.m4 +37 -0
- data/crates/backtrace-sys2/src/libbacktrace/config/warnings.m4 +227 -0
- data/crates/backtrace-sys2/src/libbacktrace/config.guess +1700 -0
- data/crates/backtrace-sys2/src/libbacktrace/config.h.in +182 -0
- data/crates/backtrace-sys2/src/libbacktrace/config.sub +1885 -0
- data/crates/backtrace-sys2/src/libbacktrace/configure +15740 -0
- data/crates/backtrace-sys2/src/libbacktrace/configure.ac +613 -0
- data/crates/backtrace-sys2/src/libbacktrace/dwarf.c +4402 -0
- data/crates/backtrace-sys2/src/libbacktrace/edtest.c +120 -0
- data/crates/backtrace-sys2/src/libbacktrace/edtest2.c +43 -0
- data/crates/backtrace-sys2/src/libbacktrace/elf.c +7443 -0
- data/crates/backtrace-sys2/src/libbacktrace/fileline.c +407 -0
- data/crates/backtrace-sys2/src/libbacktrace/filenames.h +52 -0
- data/crates/backtrace-sys2/src/libbacktrace/filetype.awk +13 -0
- data/crates/backtrace-sys2/src/libbacktrace/install-debuginfo-for-buildid.sh.in +65 -0
- data/crates/backtrace-sys2/src/libbacktrace/install-sh +501 -0
- data/crates/backtrace-sys2/src/libbacktrace/instrumented_alloc.c +114 -0
- data/crates/backtrace-sys2/src/libbacktrace/internal.h +389 -0
- data/crates/backtrace-sys2/src/libbacktrace/libtool.m4 +7436 -0
- data/crates/backtrace-sys2/src/libbacktrace/ltmain.sh +8636 -0
- data/crates/backtrace-sys2/src/libbacktrace/ltoptions.m4 +369 -0
- data/crates/backtrace-sys2/src/libbacktrace/ltsugar.m4 +123 -0
- data/crates/backtrace-sys2/src/libbacktrace/ltversion.m4 +23 -0
- data/crates/backtrace-sys2/src/libbacktrace/lt~obsolete.m4 +98 -0
- data/crates/backtrace-sys2/src/libbacktrace/macho.c +1355 -0
- data/crates/backtrace-sys2/src/libbacktrace/missing +215 -0
- data/crates/backtrace-sys2/src/libbacktrace/mmap.c +331 -0
- data/crates/backtrace-sys2/src/libbacktrace/mmapio.c +110 -0
- data/crates/backtrace-sys2/src/libbacktrace/move-if-change +83 -0
- data/crates/backtrace-sys2/src/libbacktrace/mtest.c +410 -0
- data/crates/backtrace-sys2/src/libbacktrace/nounwind.c +66 -0
- data/crates/backtrace-sys2/src/libbacktrace/pecoff.c +957 -0
- data/crates/backtrace-sys2/src/libbacktrace/posix.c +104 -0
- data/crates/backtrace-sys2/src/libbacktrace/print.c +92 -0
- data/crates/backtrace-sys2/src/libbacktrace/read.c +110 -0
- data/crates/backtrace-sys2/src/libbacktrace/simple.c +108 -0
- data/crates/backtrace-sys2/src/libbacktrace/sort.c +108 -0
- data/crates/backtrace-sys2/src/libbacktrace/state.c +72 -0
- data/crates/backtrace-sys2/src/libbacktrace/stest.c +137 -0
- data/crates/backtrace-sys2/src/libbacktrace/test-driver +148 -0
- data/crates/backtrace-sys2/src/libbacktrace/test_format.c +55 -0
- data/crates/backtrace-sys2/src/libbacktrace/testlib.c +234 -0
- data/crates/backtrace-sys2/src/libbacktrace/testlib.h +110 -0
- data/crates/backtrace-sys2/src/libbacktrace/ttest.c +161 -0
- data/crates/backtrace-sys2/src/libbacktrace/unittest.c +92 -0
- data/crates/backtrace-sys2/src/libbacktrace/unknown.c +65 -0
- data/crates/backtrace-sys2/src/libbacktrace/xcoff.c +1606 -0
- data/crates/backtrace-sys2/src/libbacktrace/xztest.c +508 -0
- data/crates/backtrace-sys2/src/libbacktrace/zstdtest.c +523 -0
- data/crates/backtrace-sys2/src/libbacktrace/ztest.c +541 -0
- data/ext/pf2/Cargo.toml +1 -0
- data/ext/pf2/src/backtrace.rs +127 -0
- data/ext/pf2/src/lib.rs +3 -0
- data/ext/pf2/src/profile.rs +16 -1
- data/ext/pf2/src/profile_serializer.rs +95 -21
- data/ext/pf2/src/ringbuffer.rs +7 -0
- data/ext/pf2/src/ruby_init.rs +18 -6
- data/ext/pf2/src/ruby_internal_apis.rs +47 -0
- data/ext/pf2/src/sample.rs +22 -1
- data/ext/pf2/src/signal_scheduler/configuration.rs +7 -0
- data/ext/pf2/src/signal_scheduler/timer_installer.rs +79 -126
- data/ext/pf2/src/signal_scheduler.rs +95 -26
- data/ext/pf2/src/timer_thread_scheduler.rs +88 -12
- data/ext/pf2/src/util.rs +2 -2
- data/lib/pf2/reporter.rb +12 -5
- data/lib/pf2/version.rb +1 -1
- data/lib/pf2.rb +3 -6
- metadata +97 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d576aec57e600cc77194fabb8c1b7b3c782c4ab76a03ec3b0f24581eb4c317ae
|
4
|
+
data.tar.gz: a290d23df802601977622f1afe39f1f2d6cd92a9350b25d203e97c3b6da6db16
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8d72fa4ccb3395f0fdd9203885c1e0cb8a00429597a6dd756e80fb70e0d8092c084992bd9595ee21789a4aaf2550e2284b6d3f81b448dc330088b325d822d85
|
7
|
+
data.tar.gz: 8f93c98574ef7077336232bb1b51a4af1ac4ba2561914a299209a5c2879fe9af3e8998c8df264836f698fea05c8d028f7ae985de3c18e9889f05568ec2740bc1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
## [Unreleased]
|
2
|
+
|
3
|
+
### Added
|
4
|
+
|
5
|
+
- New option: `track_all_threads`
|
6
|
+
- When true, all Threads will be tracked regardless of the `threads` option.
|
7
|
+
|
8
|
+
### Removed
|
9
|
+
|
10
|
+
- The `track_new_threads` option was removed in favor of the `track_all_threads` option.
|
11
|
+
|
12
|
+
|
13
|
+
## [0.3.0] - 2024-02-05
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- Native stack consolidation
|
18
|
+
- Pf2 now records native (C-level) stacks during sample capture.
|
19
|
+
- This functionality is based on [libbacktrace](https://github.com/ianlancetaylor/libbacktrace).
|
20
|
+
- New configuration interface for `Pf2.start`, `Pf2::SignalScheduler.start`, `Pf2::TimerThreadScheduler.start`
|
21
|
+
- They now accept keyword arguments (`interval_ms`, `threads`, `time_mode`, `track_new_threads`).
|
22
|
+
- New configuration options
|
23
|
+
- `interval_ms`: The sampling interval.
|
24
|
+
- `time_mode` (`:wall` or `:cpu`): The sampling timer's _mode_. `:wall` is wall-clock time (CLOCK_MONOTONIC to be specific), `:cpu` is per-thread CPU time (CLOCK_THREAD_CPUTIME_ID).
|
25
|
+
|
26
|
+
### Removed
|
27
|
+
|
28
|
+
- Configuration through positional arguments is no longer supported.
|
29
|
+
|
30
|
+
|
1
31
|
## [0.2.0] - 2024-01-21
|
2
32
|
|
3
33
|
- New Ruby interface: Pf2.start, Pf2.stop, Pf2.profile
|
@@ -5,8 +35,7 @@
|
|
5
35
|
- Implement SignalScheduler and TimerThreadScheduler
|
6
36
|
- Rewritten many components
|
7
37
|
|
38
|
+
|
8
39
|
## [0.1.0] - 2023-10-04
|
9
40
|
|
10
41
|
- Initial release
|
11
|
-
|
12
|
-
## [Unreleased]
|
data/Cargo.lock
CHANGED
@@ -46,7 +46,7 @@ version = "1.0.2"
|
|
46
46
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
47
47
|
checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648"
|
48
48
|
dependencies = [
|
49
|
-
"windows-sys",
|
49
|
+
"windows-sys 0.52.0",
|
50
50
|
]
|
51
51
|
|
52
52
|
[[package]]
|
@@ -56,7 +56,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
56
56
|
checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7"
|
57
57
|
dependencies = [
|
58
58
|
"anstyle",
|
59
|
-
"windows-sys",
|
59
|
+
"windows-sys 0.52.0",
|
60
|
+
]
|
61
|
+
|
62
|
+
[[package]]
|
63
|
+
name = "backtrace-sys2"
|
64
|
+
version = "0.1.0"
|
65
|
+
dependencies = [
|
66
|
+
"bindgen 0.69.2",
|
60
67
|
]
|
61
68
|
|
62
69
|
[[package]]
|
@@ -79,6 +86,29 @@ dependencies = [
|
|
79
86
|
"syn",
|
80
87
|
]
|
81
88
|
|
89
|
+
[[package]]
|
90
|
+
name = "bindgen"
|
91
|
+
version = "0.69.2"
|
92
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
93
|
+
checksum = "a4c69fae65a523209d34240b60abe0c42d33d1045d445c0839d8a4894a736e2d"
|
94
|
+
dependencies = [
|
95
|
+
"bitflags",
|
96
|
+
"cexpr",
|
97
|
+
"clang-sys",
|
98
|
+
"lazy_static",
|
99
|
+
"lazycell",
|
100
|
+
"log",
|
101
|
+
"peeking_take_while",
|
102
|
+
"prettyplease",
|
103
|
+
"proc-macro2",
|
104
|
+
"quote",
|
105
|
+
"regex",
|
106
|
+
"rustc-hash",
|
107
|
+
"shlex",
|
108
|
+
"syn",
|
109
|
+
"which",
|
110
|
+
]
|
111
|
+
|
82
112
|
[[package]]
|
83
113
|
name = "bitflags"
|
84
114
|
version = "2.4.1"
|
@@ -126,6 +156,12 @@ version = "1.0.0"
|
|
126
156
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
127
157
|
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
|
128
158
|
|
159
|
+
[[package]]
|
160
|
+
name = "either"
|
161
|
+
version = "1.9.0"
|
162
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
163
|
+
checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
|
164
|
+
|
129
165
|
[[package]]
|
130
166
|
name = "env_filter"
|
131
167
|
version = "0.1.0"
|
@@ -149,12 +185,31 @@ dependencies = [
|
|
149
185
|
"log",
|
150
186
|
]
|
151
187
|
|
188
|
+
[[package]]
|
189
|
+
name = "errno"
|
190
|
+
version = "0.3.8"
|
191
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
192
|
+
checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245"
|
193
|
+
dependencies = [
|
194
|
+
"libc",
|
195
|
+
"windows-sys 0.52.0",
|
196
|
+
]
|
197
|
+
|
152
198
|
[[package]]
|
153
199
|
name = "glob"
|
154
200
|
version = "0.3.1"
|
155
201
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
156
202
|
checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
157
203
|
|
204
|
+
[[package]]
|
205
|
+
name = "home"
|
206
|
+
version = "0.5.9"
|
207
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
208
|
+
checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5"
|
209
|
+
dependencies = [
|
210
|
+
"windows-sys 0.52.0",
|
211
|
+
]
|
212
|
+
|
158
213
|
[[package]]
|
159
214
|
name = "humantime"
|
160
215
|
version = "2.1.0"
|
@@ -195,6 +250,12 @@ dependencies = [
|
|
195
250
|
"winapi",
|
196
251
|
]
|
197
252
|
|
253
|
+
[[package]]
|
254
|
+
name = "linux-raw-sys"
|
255
|
+
version = "0.4.13"
|
256
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
257
|
+
checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
|
258
|
+
|
198
259
|
[[package]]
|
199
260
|
name = "log"
|
200
261
|
version = "0.4.20"
|
@@ -223,6 +284,12 @@ dependencies = [
|
|
223
284
|
"minimal-lexical",
|
224
285
|
]
|
225
286
|
|
287
|
+
[[package]]
|
288
|
+
name = "once_cell"
|
289
|
+
version = "1.19.0"
|
290
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
291
|
+
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
292
|
+
|
226
293
|
[[package]]
|
227
294
|
name = "peeking_take_while"
|
228
295
|
version = "0.1.2"
|
@@ -233,6 +300,7 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
|
|
233
300
|
name = "pf2"
|
234
301
|
version = "0.1.0"
|
235
302
|
dependencies = [
|
303
|
+
"backtrace-sys2",
|
236
304
|
"cc",
|
237
305
|
"env_logger",
|
238
306
|
"libc",
|
@@ -243,20 +311,30 @@ dependencies = [
|
|
243
311
|
"serde_json",
|
244
312
|
]
|
245
313
|
|
314
|
+
[[package]]
|
315
|
+
name = "prettyplease"
|
316
|
+
version = "0.2.16"
|
317
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
318
|
+
checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5"
|
319
|
+
dependencies = [
|
320
|
+
"proc-macro2",
|
321
|
+
"syn",
|
322
|
+
]
|
323
|
+
|
246
324
|
[[package]]
|
247
325
|
name = "proc-macro2"
|
248
|
-
version = "1.0.
|
326
|
+
version = "1.0.78"
|
249
327
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
250
|
-
checksum = "
|
328
|
+
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
|
251
329
|
dependencies = [
|
252
330
|
"unicode-ident",
|
253
331
|
]
|
254
332
|
|
255
333
|
[[package]]
|
256
334
|
name = "quote"
|
257
|
-
version = "1.0.
|
335
|
+
version = "1.0.35"
|
258
336
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
259
|
-
checksum = "
|
337
|
+
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
|
260
338
|
dependencies = [
|
261
339
|
"proc-macro2",
|
262
340
|
]
|
@@ -276,7 +354,7 @@ version = "0.9.82"
|
|
276
354
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
277
355
|
checksum = "5482a1ed4cde58dddaf162b6aebcb5c25645822547832b8be101f2acd40bcdd6"
|
278
356
|
dependencies = [
|
279
|
-
"bindgen",
|
357
|
+
"bindgen 0.66.1",
|
280
358
|
"lazy_static",
|
281
359
|
"proc-macro2",
|
282
360
|
"quote",
|
@@ -320,6 +398,19 @@ version = "1.1.0"
|
|
320
398
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
321
399
|
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
322
400
|
|
401
|
+
[[package]]
|
402
|
+
name = "rustix"
|
403
|
+
version = "0.38.21"
|
404
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
405
|
+
checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3"
|
406
|
+
dependencies = [
|
407
|
+
"bitflags",
|
408
|
+
"errno",
|
409
|
+
"libc",
|
410
|
+
"linux-raw-sys",
|
411
|
+
"windows-sys 0.48.0",
|
412
|
+
]
|
413
|
+
|
323
414
|
[[package]]
|
324
415
|
name = "ryu"
|
325
416
|
version = "1.0.15"
|
@@ -371,9 +462,9 @@ checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380"
|
|
371
462
|
|
372
463
|
[[package]]
|
373
464
|
name = "syn"
|
374
|
-
version = "2.0.
|
465
|
+
version = "2.0.48"
|
375
466
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
376
|
-
checksum = "
|
467
|
+
checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f"
|
377
468
|
dependencies = [
|
378
469
|
"proc-macro2",
|
379
470
|
"quote",
|
@@ -392,6 +483,18 @@ version = "0.2.1"
|
|
392
483
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
393
484
|
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
|
394
485
|
|
486
|
+
[[package]]
|
487
|
+
name = "which"
|
488
|
+
version = "4.4.2"
|
489
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
490
|
+
checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7"
|
491
|
+
dependencies = [
|
492
|
+
"either",
|
493
|
+
"home",
|
494
|
+
"once_cell",
|
495
|
+
"rustix",
|
496
|
+
]
|
497
|
+
|
395
498
|
[[package]]
|
396
499
|
name = "winapi"
|
397
500
|
version = "0.3.9"
|
@@ -414,13 +517,37 @@ version = "0.4.0"
|
|
414
517
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
415
518
|
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
416
519
|
|
520
|
+
[[package]]
|
521
|
+
name = "windows-sys"
|
522
|
+
version = "0.48.0"
|
523
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
524
|
+
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
|
525
|
+
dependencies = [
|
526
|
+
"windows-targets 0.48.5",
|
527
|
+
]
|
528
|
+
|
417
529
|
[[package]]
|
418
530
|
name = "windows-sys"
|
419
531
|
version = "0.52.0"
|
420
532
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
421
533
|
checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d"
|
422
534
|
dependencies = [
|
423
|
-
"windows-targets",
|
535
|
+
"windows-targets 0.52.0",
|
536
|
+
]
|
537
|
+
|
538
|
+
[[package]]
|
539
|
+
name = "windows-targets"
|
540
|
+
version = "0.48.5"
|
541
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
542
|
+
checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c"
|
543
|
+
dependencies = [
|
544
|
+
"windows_aarch64_gnullvm 0.48.5",
|
545
|
+
"windows_aarch64_msvc 0.48.5",
|
546
|
+
"windows_i686_gnu 0.48.5",
|
547
|
+
"windows_i686_msvc 0.48.5",
|
548
|
+
"windows_x86_64_gnu 0.48.5",
|
549
|
+
"windows_x86_64_gnullvm 0.48.5",
|
550
|
+
"windows_x86_64_msvc 0.48.5",
|
424
551
|
]
|
425
552
|
|
426
553
|
[[package]]
|
@@ -429,51 +556,93 @@ version = "0.52.0"
|
|
429
556
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
430
557
|
checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd"
|
431
558
|
dependencies = [
|
432
|
-
"windows_aarch64_gnullvm",
|
433
|
-
"windows_aarch64_msvc",
|
434
|
-
"windows_i686_gnu",
|
435
|
-
"windows_i686_msvc",
|
436
|
-
"windows_x86_64_gnu",
|
437
|
-
"windows_x86_64_gnullvm",
|
438
|
-
"windows_x86_64_msvc",
|
559
|
+
"windows_aarch64_gnullvm 0.52.0",
|
560
|
+
"windows_aarch64_msvc 0.52.0",
|
561
|
+
"windows_i686_gnu 0.52.0",
|
562
|
+
"windows_i686_msvc 0.52.0",
|
563
|
+
"windows_x86_64_gnu 0.52.0",
|
564
|
+
"windows_x86_64_gnullvm 0.52.0",
|
565
|
+
"windows_x86_64_msvc 0.52.0",
|
439
566
|
]
|
440
567
|
|
568
|
+
[[package]]
|
569
|
+
name = "windows_aarch64_gnullvm"
|
570
|
+
version = "0.48.5"
|
571
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
572
|
+
checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8"
|
573
|
+
|
441
574
|
[[package]]
|
442
575
|
name = "windows_aarch64_gnullvm"
|
443
576
|
version = "0.52.0"
|
444
577
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
445
578
|
checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea"
|
446
579
|
|
580
|
+
[[package]]
|
581
|
+
name = "windows_aarch64_msvc"
|
582
|
+
version = "0.48.5"
|
583
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
584
|
+
checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc"
|
585
|
+
|
447
586
|
[[package]]
|
448
587
|
name = "windows_aarch64_msvc"
|
449
588
|
version = "0.52.0"
|
450
589
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
451
590
|
checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef"
|
452
591
|
|
592
|
+
[[package]]
|
593
|
+
name = "windows_i686_gnu"
|
594
|
+
version = "0.48.5"
|
595
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
596
|
+
checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e"
|
597
|
+
|
453
598
|
[[package]]
|
454
599
|
name = "windows_i686_gnu"
|
455
600
|
version = "0.52.0"
|
456
601
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
457
602
|
checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313"
|
458
603
|
|
604
|
+
[[package]]
|
605
|
+
name = "windows_i686_msvc"
|
606
|
+
version = "0.48.5"
|
607
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
608
|
+
checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406"
|
609
|
+
|
459
610
|
[[package]]
|
460
611
|
name = "windows_i686_msvc"
|
461
612
|
version = "0.52.0"
|
462
613
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
463
614
|
checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a"
|
464
615
|
|
616
|
+
[[package]]
|
617
|
+
name = "windows_x86_64_gnu"
|
618
|
+
version = "0.48.5"
|
619
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
620
|
+
checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e"
|
621
|
+
|
465
622
|
[[package]]
|
466
623
|
name = "windows_x86_64_gnu"
|
467
624
|
version = "0.52.0"
|
468
625
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
469
626
|
checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd"
|
470
627
|
|
628
|
+
[[package]]
|
629
|
+
name = "windows_x86_64_gnullvm"
|
630
|
+
version = "0.48.5"
|
631
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
632
|
+
checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc"
|
633
|
+
|
471
634
|
[[package]]
|
472
635
|
name = "windows_x86_64_gnullvm"
|
473
636
|
version = "0.52.0"
|
474
637
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
475
638
|
checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e"
|
476
639
|
|
640
|
+
[[package]]
|
641
|
+
name = "windows_x86_64_msvc"
|
642
|
+
version = "0.48.5"
|
643
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
644
|
+
checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538"
|
645
|
+
|
477
646
|
[[package]]
|
478
647
|
name = "windows_x86_64_msvc"
|
479
648
|
version = "0.52.0"
|
data/Cargo.toml
CHANGED
data/README.md
CHANGED
@@ -8,6 +8,7 @@ Notable Capabilites
|
|
8
8
|
|
9
9
|
- Can accurately track multiple Ruby Threads' activity
|
10
10
|
- Sampling interval can be set based on per-Thread CPU usage
|
11
|
+
- Can record native (C-level) stack traces side-by-side with Ruby traces
|
11
12
|
|
12
13
|
Usage
|
13
14
|
--------
|
@@ -17,11 +18,10 @@ Usage
|
|
17
18
|
Pf2 will collect samples every 10 ms of wall time by default.
|
18
19
|
|
19
20
|
```ruby
|
20
|
-
#
|
21
|
-
|
22
|
-
|
23
|
-
your_code_here
|
24
|
-
Thread.new { threaded_code() } # will also be profiled if second argument is true
|
21
|
+
# Threads in `threads` will be tracked
|
22
|
+
Pf2.start(threads: [Thread.current])
|
23
|
+
|
24
|
+
your_code_here
|
25
25
|
|
26
26
|
# Stop profiling and save the profile for visualization
|
27
27
|
profile = Pf2.stop
|
@@ -50,7 +50,19 @@ $ pf2 -o report.json my_program.pf2profile
|
|
50
50
|
|
51
51
|
### Configuration
|
52
52
|
|
53
|
-
|
53
|
+
Pf2 accepts the following configuration keys:
|
54
|
+
|
55
|
+
```rb
|
56
|
+
Pf2.start(
|
57
|
+
interval_ms: 49, # Integer: The sampling interval in milliseconds (default: 49)
|
58
|
+
threads: [], # Array<Thread>: A list of Ruby Threads to be tracked (default: `Thread.list`)
|
59
|
+
time_mode: :cpu, # `:cpu` or `:wall`: The sampling timer's mode
|
60
|
+
# (default: `:cpu` for SignalScheduler, `:wall` for TimerThreadScheduler)
|
61
|
+
track_all_threads: true # Boolean: Whether to track all Threads regardless of `threads` option
|
62
|
+
# (default: false)
|
63
|
+
)
|
64
|
+
```
|
65
|
+
|
54
66
|
|
55
67
|
Overhead
|
56
68
|
--------
|
data/Rakefile
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
require 'bundler/gem_tasks'
|
2
2
|
require 'rake/extensiontask'
|
3
|
+
require 'minitest/test_task'
|
3
4
|
|
4
5
|
task default: %i[]
|
5
6
|
|
6
7
|
Rake::ExtensionTask.new 'pf2' do |ext|
|
7
8
|
ext.lib_dir = 'lib/pf2'
|
8
9
|
end
|
10
|
+
|
11
|
+
Minitest::TestTask.create(:test) do |t|
|
12
|
+
t.libs << "test"
|
13
|
+
t.libs << "lib"
|
14
|
+
t.warning = false
|
15
|
+
t.test_globs = ["test/**/*_test.rb"]
|
16
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/target
|
@@ -0,0 +1,48 @@
|
|
1
|
+
use std::env;
|
2
|
+
use std::path::Path;
|
3
|
+
use std::path::PathBuf;
|
4
|
+
use std::process::Command;
|
5
|
+
|
6
|
+
fn main() {
|
7
|
+
let libbacktrace_src_dir = Path::new("src/libbacktrace").canonicalize().unwrap();
|
8
|
+
|
9
|
+
// Run ./configure
|
10
|
+
let configure_status = Command::new("./configure")
|
11
|
+
.current_dir(&libbacktrace_src_dir)
|
12
|
+
.status()
|
13
|
+
.expect("libbacktrace: ./configure failed");
|
14
|
+
if !configure_status.success() {
|
15
|
+
panic!("libbacktrace: ./configure failed");
|
16
|
+
}
|
17
|
+
|
18
|
+
// Run make
|
19
|
+
let make_status = Command::new("make")
|
20
|
+
.current_dir(&libbacktrace_src_dir)
|
21
|
+
.status()
|
22
|
+
.expect("libbacktrace: make failed");
|
23
|
+
if !make_status.success() {
|
24
|
+
panic!("libbacktrace: make failed");
|
25
|
+
}
|
26
|
+
|
27
|
+
// Generate bindings
|
28
|
+
let bindings = bindgen::Builder::default()
|
29
|
+
.header(format!("{}/backtrace.h", libbacktrace_src_dir.display()))
|
30
|
+
.allowlist_function("backtrace_.*")
|
31
|
+
.generate_comments(true)
|
32
|
+
.parse_callbacks(Box::new(bindgen::CargoCallbacks::new()))
|
33
|
+
.generate()
|
34
|
+
.expect("Failed to generate bindings");
|
35
|
+
|
36
|
+
// Output bindings to the src directory
|
37
|
+
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
38
|
+
bindings
|
39
|
+
.write_to_file(out_path.join("backtrace_bindings.rs"))
|
40
|
+
.expect("Failed to write bindings");
|
41
|
+
|
42
|
+
println!("cargo:rerun-if-changed=build.rs");
|
43
|
+
println!(
|
44
|
+
"cargo:rustc-link-search=native={}",
|
45
|
+
libbacktrace_src_dir.join(".libs").display()
|
46
|
+
);
|
47
|
+
println!("cargo:rustc-link-lib=static=backtrace");
|
48
|
+
}
|