hsperf
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.
Usage
hsperf <pid> [-i <ms>] [<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. If -i <ms> is given, the counters
will be queried and printed all <ms> milliseconds.
How it works
- Reads
/proc/[pid]/mapsto find the location and the base address oflibjvm.so. - Parses
libjvm.soto get the address ofPerfDatastructure. - Calls
process_vm_readvto readPerfDataof 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.
Supported OS
Linux 3.2+ 64-bit