Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign updtrace probes #875
Comments
steveklabnik
added
A-enhancement
labels
Feb 16, 2015
alexcrichton
added
T-dev-tools
and removed
T-dev-tools
labels
May 18, 2015
This comment has been minimized.
This comment has been minimized.
tromey
commented
Apr 1, 2016
|
Linux has its own form of static probe: https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation. They are very low cost and various tools, like gdb and systemtap, already know how to access them. |
This comment has been minimized.
This comment has been minimized.
petrochenkov
removed
A-wishlist
labels
Feb 24, 2018
This comment has been minimized.
This comment has been minimized.
Fiedzia
commented
Oct 24, 2018
|
Its been a while, I looked at it recently and I can't see any way to get it working on stable. |
This comment has been minimized.
This comment has been minimized.
|
With the up-and-coming support for eBPF-based program tracing using tools like |
This comment has been minimized.
This comment has been minimized.
|
@jonhoo AFAIK my |
This comment has been minimized.
This comment has been minimized.
|
I wonder whether |
This comment has been minimized.
This comment has been minimized.
|
I haven't tried with eBPF, but it ought to work -- I implemented it the same way as |
This comment has been minimized.
This comment has been minimized.
|
I can confirm that #![feature(asm)]
#[macro_use]
#[no_link]
extern crate probe;to inferno here. I then added annotations here: if line.is_empty() {
probe!(inferno_collapse_perf, post_stack);
self.after_event();
} else {
probe!(inferno_collapse_perf, in_stack);
self.on_line(line.trim_end());
}This then let me do this: $ sudo bpftrace -e "usdt:$CARGO_TARGET_DIR/release/inferno-collapse-perf:inferno_collapse_perf:post_stack /@start[pid]/ { @ns[comm]= hist(nsecs - @start[pid]); delete(@start[pid]); } usdt:$CARGO_TARGET_DIR/release/inferno-collapse-perf:inferno_collapse_perf:post_stack { @start[pid] = nsecs; }"
Attaching 2 probes...
^C
@ns[inferno-collaps]:
[1K, 2K) 24014 |@@@@ |
[2K, 4K) 108620 |@@@@@@@@@@@@@@@@@@ |
[4K, 8K) 129485 |@@@@@@@@@@@@@@@@@@@@@ |
[8K, 16K) 310007 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@|
[16K, 32K) 244627 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ |
[32K, 64K) 69413 |@@@@@@@@@@@ |
[64K, 128K) 21566 |@@@ |
[128K, 256K) 152 | |
[256K, 512K) 1 | |
[512K, 1M) 2 | |That's really neat! The command is a little awkward since bpftrace requires that the name of the binary matches the program name (iovisor/bpftrace#328 (comment)), and Rust identifiers cannot have |
This comment has been minimized.
This comment has been minimized.
|
Also note that with iovisor/bpftrace#444 (which is really iovisor/bpftrace#280), the above can (?) be simplified greatly to: $ sudo bpftrace -p $(pgrep inferno-collapse-perf) -e "\
usdt::post_stack /@start[pid]/ { @ns[comm]= hist(nsecs - @start[pid]); delete(@start[pid]); }\
usdt::post_stack { @start[pid] = nsecs; }" |
steveklabnik commentedFeb 16, 2015
Wednesday May 29, 2013 at 23:45 GMT
For earlier discussion, see rust-lang/rust#6816
This issue was labelled with: A-instrumentation, A-libs, I-enhancement, P-low in the Rust repository
I think rust should expose dtrace userland probes
Links:
http://www.solarisinternals.com/wiki/index.php/DTrace_Topics_USDT
https://wikis.oracle.com/display/DTrace/Statically+Defined+Tracing+for+User+Applications
https://wiki.freebsd.org/DTrace/userland
Some specific providers (including some dynamic):
https://github.com/chrisa/libusdt
https://github.com/chrisa/node-dtrace-provider
http://prefetch.net/projects/apache_modtrace/index.html
https://bugzilla.mozilla.org/show_bug.cgi?id=370906
Probably at least some for pervasive / standard-library actions:
Note that the "USDT" mechanism provides static probes whereas things like
libusdt(above) provide an API for dynamically registering probes at runtime. This is probably important, possibly even a good place to start, though it's slightly more expensive; ideally of course we should be able to provide both.See also #6810 concerning
metrics. I think there's some potential design-informing between the two. Possibly libusdt as a reporting sink for metrics?