Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/sample/dtrace/hotspot_jni/README.txt
32287 views
================================1'hotspot_jni' PROBES DESCRIPTION2================================34This directory contains D scripts which demonstrate usage of 'hotspot_jni'5provider probes.67In order to call from native code to Java code, due to embedding of the VM8in an application or execution of native code within a Java application, the9native code must make a call through the JNI interface. The JNI interface10provides a number of methods for invoking Java code and examining the state11of the VM. DTrace probes are provided at the entry point and return point12for each of these methods. The probes are provided by the hotspot_jni13provider. The name of the probe is the name of the JNI method, appended with14"-entry" for entry probes, and "-return" for return probes. The arguments15available at each entry probe are the arguments that were provided to the16function (with the exception of the Invoke* methods, which omit the17arguments that are passed to the Java method). The return probes have the18return value of the method as an argument (if available).1920You can find more information about HotSpot probes here:21http://java.sun.com/javase/6/docs/technotes/guides/vm/dtrace.html2223===========24THE SCRIPTS25===========2627The following scripts/samples which demonstrate hotspot_jni probes usage are28available:2930- CriticalSection.d31Inspect a JNI application for Critical Section violations.3233- CriticalSection_slow.d34Do the same as CriticalSection.d but provide more debugging info.3536- hotspot_jni_calls_stat.d37This script collects statistics about how many times particular JNI method38has been called.3940- hotspot_jni_calls_tree.d41The script prints tree of JNI method calls.4243See more details in the scripts.444546==========47HOW TO RUN48==========49To run any dscript from hotspot directory you can do either:5051# dscript.d -c "java ..."5253or if you don't have Solaris 10 patch which allows to specify probes that54don't yet exist ( Hotspot DTrace probes are defined in libjvm.so and as55result they could be not been yet loaded when you try to attach dscript to56the Java process) do:5758# ../helpers/dtrace_helper.d -c "java ..." dscript.d5960or if your application is already running you can just simply attach61the D script like:6263# dscript.d -p JAVA_PID646566