jdk/src/sample/solaris/dtrace/hotspot/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' 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' provider probes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
The 'hotspot' provider makes available probes that can be used to track the
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
lifespan of the VM, thread start and stop events, GC and memory pool
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
statistics, method compilations, and monitor activity. With a startup flag,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
additional probes are enabled which can be used to monitor the running Java
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
program, such as method enter and return probes, and object allocations. All
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
of the hotspot probes originate in the VM library (libjvm.so), so they are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
also provided from programs which embed the VM.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
Many of the probes in the provider have arguments that can be examined to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
provide further details on the state of the VM. Many of these probes'
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
arguments are opaque IDs which can be used to link probe firings to each
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
other, however strings and other data are also provided. When string values
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
are provided, they are always present as a pair: a pointer to unterminated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
modified UTF-8 data (see JVM spec: 4.4.7) , and a length value which
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
indicates the extent of that data. Because the string data (even when none
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
of the characters are outside the ASCII range) is not guaranteed to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
terminated by a NULL character, it is necessary to use the length-terminated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
copyinstr() intrinsic to read the string data from the process.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
You can find more information about HotSpot probes here:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
http://java.sun.com/javase/6/docs/technotes/guides/vm/dtrace.html
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
===========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
THE SCRIPTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
===========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
The following scripts/samples which demonstrate 'hotspot' probes usage are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
available:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
- class_loading_stat.d 
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
  The script collects statistics about loaded and unloaded Java classes and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
  dump current state to stdout every N seconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
- gc_time_stat.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
  The script measures the duration of a time spent in GC.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
  The duration is measured for every memory pool every N seconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
- hotspot_calls_tree.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
  The script prints calls tree of fired 'hotspot' probes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
- method_compile_stat.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
  The script prints statistics about N methods with largest/smallest
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  compilation time every M seconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
- method_invocation_stat.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  The script collects statistics about Java method invocations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
- method_invocation_stat_filter.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
  The script collects statistics about Java method invocations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  You can specify package, class or method name to trace.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
- method_invocation_tree.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  The script prints tree of Java and JNI method invocations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
- monitors.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  The script traces monitor related probes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
- object_allocation_stat.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  The script collects statistics about N object allocations every M seconds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
==========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
HOW TO RUN
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
==========
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
To run any D script from hotspot directory you can do either:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 # dscript.d -c "java ..."
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 or if you don't have Solaris 10 patch which allows to specify probes that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 don't yet exist ( Hotspot DTrace probes are defined in libjvm.so and as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 result they could be not been yet loaded when you try to attach D script to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 the Java process) do:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 # ../helpers/dtrace_helper.d -c "java ..." dscript.d
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 or if your application is already running you can just simply attach
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 the D script like:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 # dscript.d -p JAVA_PID