Prints HotSpot perf counters, even when the target JVM is started with -XX:+PerfDisableSharedMem
flag.
Unlike other similar utilities, it does not rely on access to /tmp/hsperfdata_user
files.
Does not require JDK to run. Works with all versions of HotSpot JVM.
hsperf <pid> [<counter>...]
If only <pid>
is specified, the program prints all counters with their names.
If a space separated list of counter names is given, the program prints values
of the specified counters, one value per line.
- Reads
/proc/[pid]/maps
to find the location and the base address oflibjvm.so
. - Parses
libjvm.so
to get the address ofPerfData
structure. - Calls
process_vm_readv
to readPerfData
of the target JVM.
If libjvm.so
does not contain debug symbols, the program gets the address of
VMStructs
instead (which is always available) and then looks for PerfData
addresses using VMStructs
.
Linux 3.2+ 64-bit