| Solaris |
|
|
jdtrace is a Java program that emulates dtrace(1M) using the Java DTrace API. It currently supports the following options:
Usage: java JDTrace [-32|-64] [-CeFlqvVwZ] [-b bufsz] [-c cmd] [-D name[=def]]
[-I path] [-L path] [-o output] [-p pid] [-s script] [-U name]
[-x opt[=val]] [-X a|c|s|t]
[-P provider [[ predicate ] action ]]
[-m [ provider: ] module [[ predicate ] action ]]
[-f [[ provider: ] module: ] func [[ predicate ] action ]]
[-n [[[ provider: ] module: ] func: ] name [[ predicate ] action ]]
[-i probe-id [[ predicate ] action ]] [ args ... ]
predicate -> '/' D-expression '/'
action -> '{' D-statements '}'
-32 generate 32-bit D programs
-64 generate 64-bit D programs
-b set trace buffer size
-c run specified command and exit upon its completion
-C run cpp(1) preprocessor on script files
-D define symbol when invoking preprocessor
-e exit after compiling request but prior to enabling probes
-f enable or list probes matching the specified function name
-F coalesce trace output by function
-i enable or list probes matching the specified probe id
-I add include directory to preprocessor search path
-l list probes matching specified criteria
-L add library directory to library search path
-m enable or list probes matching the specified module name
-n enable or list probes matching the specified probe name
-o set output file
-p grab specified process-ID and cache its symbol tables
-P enable or list probes matching the specified provider name
-q set quiet mode (only output explicitly traced data)
-s enable or list probes according to the specified D script
-U undefine symbol when invoking preprocessor
-v set verbose mode (report stability attributes, arguments)
-V report DTrace API version
-w permit destructive actions
-x enable or modify compiler and tracing options
-X specify ISO C conformance settings for preprocessor
-Z permit probe descriptions that match zero probes
To run remotely use the "host" option with -x:
-xhost=<hostname> [ -xport=<port-number> ]
To log PrintaRecord, set this environment variable:
JDTRACE_LOGGING_LEVEL=FINE
To log ProbeData, set JDTRACE_LOGGING_LEVEL=FINER
Other than the initial 'j', you run it just like dtrace(1M), for example:
% jdtrace -n 'syscall:::entry { @[execname] = count(); }' -n 'tick-1sec { printa(@); clear(@); }'
jdtrace requires the Java DTrace API. Specifically, it requires
/usr/share/lib/java/dtrace.jar (Solaris Nevada build 50 or later)
Here is the jdtrace source (licensed under CDDL):
Extracting the tar creates a jdtrace directory with the following files:
jdtrace/
jdtrace/Makefile
jdtrace/jdtrace.c
jdtrace/JDTrace.java
jdtrace/Getopt.java
jdtrace/opensolaris.license.txt
jdtrace/jdtrace.jar-manifest
Simply run
% make
in the extracted directory. The Makefile also supports the clean and clobber targets.
jdtrace makes it possible to test the Java DTrace API using the existing DTrace test suite. I hope it also provides useful examples of how to access common DTrace functionality using the API.
Terms of Use
|
Privacy
|
Trademarks
|
Copyright Policy
|
Site Guidelines
|
Site Map
|
Help
Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Use.
© 2012, Oracle Corporation and/or its affiliates.