Systemtap scripts using hotspot and hotspot_jni tapsets from IcedTeaBelow are a few examples demonstrating possible uses for systemtap static probe tracing in IcedTea/OpenJDK.
To run these scripts, you'll need a fairly recent IcedTea6 build of OpenJDK, which has been configured with the "--enable-systemtap" option. This may already be included on your system. At this point I assume you have systemtap installed and are able to run a systemtap script in the general case; if not, see the SystemTap page. JThreadStats, displays a summary of the method calls of each thread in a java program. The current and maximal method nesting depth, as well as a tally of the number of method calls, are displayed for each thread. Run as: JObjectStats, displays a summary of each thread's object allocations (number and total size in bytes of objects). Also displayed is a tally of garbage collection executions. Run as: JObjectStats2, based on above. Displays, for each thread showing activity in an interval, the top 5 class types allocated. Intervals terminate once a single class has been allocated 8192 times in a single thread, or every 3 seconds. Cumulative data is stored for a final summary once process ends. Run as: JContendStats, displays a summary of each thread's contention status. Threads that have not shown contention activity are omitted. Also displayed is a tally of wait events per thread, as well as total waiting time. Run as: You can also run a java app directly (rather than calling the java executable), provided the app has a way to pass the appropriate -XX parameter to the jvm. There is a -XX:+ExtendedDtraceProbes which implies all three off the -XX parameters used above; these enable optional dtrace probes, as documented here. Having the probes enabled adds significant overhead, so only the necessary group(s) of probes should be enabled when attempting to trace java programs using systemtap. |