Many know that DTrace is a great tool for profiling and understanding operating system level behavior. Less know that many popular programming languages provide DTrace probes which enable full stack tracing and probing.
a probe, optional predicate and optional actions in a braced clause! • Supports BEGIN and END blocks! • Local variables (this->foo = 42)! • Aggregate/associative variables (prefixed with @)! • One liner support in the form! dtrace -n 'probe /predicate/ {action}'
entries by package and sub name * arg3 = package name (Foo::Bar) * arg0 = subroutine name (do_something) */ @[strjoin(strjoin(copyinstr(arg3),"::"),copyinstr(arg0))] = count() } END { /* Give me top 10 highest counts; throw away rest */ trunc(@, 10) }
entries by package and sub name * arg3 = package name (Foo::Bar) * arg0 = subroutine name (do_something) */ @[strjoin(strjoin(copyinstr(arg3),"::"),copyinstr(arg0))] = count() } END { /* Give me top 10 highest counts; throw away rest */ trunc(@, 10) }
entries by package and sub name * arg3 = package name (Foo::Bar) * arg0 = subroutine name (do_something) */ @[strjoin(strjoin(copyinstr(arg3),"::"),copyinstr(arg0))] = count() } END { /* Give me top 10 highest counts; throw away rest */ trunc(@, 10) }
entries by package and sub name * arg3 = package name (Foo::Bar) * arg0 = subroutine name (do_something) */ @[strjoin(strjoin(copyinstr(arg3),"::"),copyinstr(arg0))] = count() } END { /* Give me top 10 highest counts; throw away rest */ trunc(@, 10) }
DTrace probes! 5.10.1! sub-entry, sub-return! 5.14.x! sub-entry and return get package name as an argument! 5.16.x! phase-change! 5.18.0! op-entry, loading-file, loaded- file!