Quick command line search for top 10 largest GC pauses.
NB You won't need all of these switches to get the pause timings but when debugging GC problems the extra info can be fed into a tool like https://www.jclarity.com/censum/ for a better understanding.
G1GC collector
VM Switches used
-XX:+UseG1GC \
-XX:MaxGCPauseMillis=100 \
-XX:+UnlockDiagnosticVMOptions \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintGCApplicationConcurrentTime \
-XX:+PrintTenuringDistribution \
-XX:+PrintSafepointStatistics \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-Xloggc:g1gc.log
-XX:MaxGCPauseMillis=100 \
-XX:+UnlockDiagnosticVMOptions \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintGCApplicationConcurrentTime \
-XX:+PrintTenuringDistribution \
-XX:+PrintSafepointStatistics \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-Xloggc:g1gc.log
Command line
grep real= g1gc.log | tr -s ' ' | cut -d' ' -f5 | sort -r | head -n 10
Results
real=0.49
real=0.11
real=0.10
real=0.09
real=0.09
real=0.09
real=0.09
real=0.09
real=0.09
real=0.08
real=0.11
real=0.10
real=0.09
real=0.09
real=0.09
real=0.09
real=0.09
real=0.09
real=0.08
Parallel collector
VM Switches used
-XX:+UnlockDiagnosticVMOptions \
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintGCApplicationConcurrentTime \
-XX:+PrintTenuringDistribution \
-XX:+PrintSafepointStatistics \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-Xloggc:pargc.log
-XX:+PrintGCApplicationStoppedTime \
-XX:+PrintGCApplicationConcurrentTime \
-XX:+PrintTenuringDistribution \
-XX:+PrintSafepointStatistics \
-XX:+PrintGCDetails \
-XX:+PrintGCDateStamps \
-Xloggc:pargc.log
Command line
grep real= pargc.log | tr -s ' ' | cut -d' ' -f9 | sort -r | head -n 10
Results
real=2.03
real=1.83
real=1.37
real=1.35
real=0.87
real=0.80
real=0.51
real=0.47
real=0.46
real=0.45
real=1.83
real=1.37
real=1.35
real=0.87
real=0.80
real=0.51
real=0.47
real=0.46
real=0.45