The problem is that on SmartOS (and other lighting options), as well as on their own Solaris siblings, the DTrace module in the JVM is lazily loaded (i.e. DOF compiled with -x lazyload ). As a result, DTrace sensors do not load until explicit activation. There are two ways to handle this. First, you can say that DTrace itself included specific test objects, forcing the target process to load its probes. This requires (at least) the identifier of the target process; to resolve this in the example presented in the question, it would be something like this:
% pfexec dtrace -ln 'hotspot*$target:::' -p `pgrep -fn "java Loop"`
This will pick up the USDT hotspot (and hotspot_jni ) testers, but still does not work using the jstack() action on a machine filled with unsuspecting Java processes. (That is, it works when you want to use USDT probes on a well-known process, and not when you want to use the ustack helper profile for all Java processes.) If this is the problem you care about, in the lighting options (SmartOS, OmniOS, etc.) .d.), you can effectively cancel the lazy loading of DTrace probes (and the stack assistant) using the audit library dedicated to the task. This library - /usr/lib/dtrace/libdtrace_forceload.so and its 64-bit version, /usr/lib/dtrace/64/libdtrace_forceload.so - effectively forces DTrace probes to load when the process starts, providing you with USDT probes and the jstack() action jstack() for all such processes. To do this, for 32-bit JVMs, start java using the LD_AUDIT_32 environment LD_AUDIT_32 :
export LD_AUDIT_32=/usr/lib/dtrace/libdtrace_forceload.so
For 64-bit JVMs:
export LD_AUDIT_64=/usr/lib/dtrace/64/libdtrace_forceload.so
Bryan cantrill
source share