Skip to content

jstack profiler

M. Isuru Tharanga Chrishantha Perera edited this page Feb 22, 2018 · 1 revision

jstack-profiler

Naive Java Profiler using jstack command.

Usage

./jstack-profiler -h

Usage: 
jstack-profiler -p <pid> [-n <number_of_samples>] [-i <sample_interval[suffix]>] [-o <output_directory>] [-x] [-h]

-p: The Java Process ID
-n: Number of samples to take. Default: 150
-i: Sample interval. Default: 2s. Floating point numbers are accepted
    Suffix may be: 
    s - seconds (the default)
    m - minutes
    h - hours
    d - days
-o: Output directory to save results
-x: Do not save 'ps' command output
-h: Display this help

Example: Profiling highcpu sample program

./jstack-profiler -p `pgrep -f highcpu`
The jstack samples will be saved in /tmp/jstack-profiler.525gu9
Progress: 16%

Example: Taking 30 samples with 1 second sample interval

/jstack-profiler -p `pgrep -f highcpu` -n 30 -i 1s
The jstack samples will be saved in /tmp/jstack-profiler.TbxkWJ
Progress: 16%