[dtrace-discuss] Using dtrace to monitor native calls into Java code

Keith McGuigan
Wed, 10 Feb 2010 12:27:22 -0000

Eric Bodden wrote:
> Hello everybody.
>
> I am trying to use dtrace to monitor native calls (from the Hotspot
> VM) into Java code. Such calls occur, for instance, when invoking a
> method using reflection.
>
> I found this web page about dtrace probes in hotspot:
> http://java.sun.com/javase/6/docs/technotes/guides/vm/dtrace.html
>
> I tried out the probes. Especially, the Call*Method*-entry probes of
> hotspot_jni looked promising. However, they do not seem to be
> triggering, e.g. for reflective calls. Could the problem be that these
> probes only monitor calls through JNI but Hotspot does not actually
> use JNI to dispatch these calls into Java code? If so, does anybody
> else have an idea of how to monitor reflective calls into Java code?

Right.  Hotspot does not use JNI to dispatch to native code.  The
method-entry/return calls might help out here, but they monitor all
calls which may be overkill for what you''re doing.

--
- Keith