jdk/src/sample/solaris/dtrace/hotspot_jni/README.txt
author hseigel
Wed, 01 Mar 2017 08:00:02 -0500
changeset 46194 5596e6f63072
parent 25859 3317bb8137f4
permissions -rw-r--r--
8172307: Remove ununsed JVM API JVM_GetModuleByPackageName() Summary: Remove get_module_by_package_name() etc., and unneeded test. Reviewed-by: sspitsyn, gtriantafill
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
'hotspot_jni' PROBES DESCRIPTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
================================
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
This directory contains D scripts which demonstrate usage of 'hotspot_jni'
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
provider probes. 
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
In order to call from native code to Java code, due to embedding of the VM
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
in an application or execution of native code within a Java application, the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
native code must make a call through the JNI interface. The JNI interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
provides a number of methods for invoking Java code and examining the state
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
of the VM. DTrace probes are provided at the entry point and return point
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
for each of these methods. The probes are provided by the hotspot_jni
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
provider. The name of the probe is the name of the JNI method, appended with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
"-entry" for entry probes, and "-return" for return probes. The arguments
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
available at each entry probe are the arguments that were provided to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
function (with the exception of the Invoke* methods, which omit the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
arguments that are passed to the Java method). The return probes have the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
return value of the method as an argument (if available).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
You can find more information about HotSpot probes here:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
http://java.sun.com/javase/6/docs/technotes/guides/vm/dtrace.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
===========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
THE SCRIPTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
===========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
The following scripts/samples which demonstrate hotspot_jni probes usage are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
available:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
- CriticalSection.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
  Inspect a JNI application for Critical Section violations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
- CriticalSection_slow.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
  Do the same as CriticalSection.d but provide more debugging info.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
- hotspot_jni_calls_stat.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  This script collects statistics about how many times particular JNI method
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  has been called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
- hotspot_jni_calls_tree.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
  The script prints tree of JNI method calls.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
See more details in the scripts.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
==========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
HOW TO RUN
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
==========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
To run any dscript from hotspot directory you can do either:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 # dscript.d -c "java ..."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 or if you don't have Solaris 10 patch which allows to specify probes that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 don't yet exist ( Hotspot DTrace probes are defined in libjvm.so and as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 result they could be not been yet loaded when you try to attach dscript to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 the Java process) do:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 # ../helpers/dtrace_helper.d -c "java ..." dscript.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 or if your application is already running you can just simply attach
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 the D script like:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 # dscript.d -p JAVA_PID