|
Java DTrace API
Java DTrace API
The Java DTrace API is now available on Solaris Nevada (build 35 or
later). This is the first public programming interface for
DTrace. (The native DTrace library implemented in C is currently
private.) Bindings for other programming/scripting languages should
eventually arrive on the scene as well.
The Chime project page on OpenSolaris has more
information about the API, including source and
examples. One example to highlight here: I thought that a Java
implementation of dtrace(1M) would be a great way to
demonstrate how to use the new API to access functionality associated
with familiar dtrace command options. Get jdtrace
and give it a try. The majority of options are supported and in most cases the output of jdtrace and dtrace(1M) should be
identical. I also emulated the behavior of Ctrl-C (printing
unprinted aggregations before exiting) using
Runtime.getRuntime().addShutdownHook() (this
Java Developer Forums thread has other suggestions for handling
Ctrl-C in Java).
Primarily I use jdtrace to leverage the existing DTrace test
suite (and its thousand-or-so D programs) for testing of the Java DTrace
API. I hope it also serves as a source of programming examples.
I should also mention the
Chime Visualization Tool for DTrace, a new project on OpenSolaris
that uses the Java DTrace API to display multiple running aggregations
simultaneously. Please visit the project page and share your feedback
on the dtrace-discuss list.
( Apr 22 2006, 12:59:47 AM PDT / Apr 22 2006, 12:26:00 PM PDT )
Permalink
Trackback: http://blogs.sun.com/tomee/entry/java_dtrace_api
|