Skip to content

Instantly share code, notes, and snippets.

@justdoit0823
Last active January 26, 2021 15:09
Show Gist options
  • Save justdoit0823/cfd1bf699352c13fd85a853782edbd15 to your computer and use it in GitHub Desktop.
Save justdoit0823/cfd1bf699352c13fd85a853782edbd15 to your computer and use it in GitHub Desktop.
Stat g1 jni stall in jvm 8 with awk.
// jni stall
awk '/Setting _needs_gc/ || /is performing GC after exiting critical section/ {split($1, a, ":"); if($0 ~ /Setting _needs_gc/) {print "b", a[1];} else {print "e", a[1];}}' gc.log|awk '{if($1 == "b") {t1 = $2; next} if(t1 != 0) {d = $2 - t1; t1 = 0; print d; next}}'
// safepoint synchronization stall
grep 'GCLocker Initiated GC' -B 1 gc.log |grep -v '\-\-'|grep -v Times|awk 'NR % 2 == 1 {split($1, a, ":"); t1 = a[1]; cs=1; if ($0 ~ /GCLocker Initiated GC/) {cs=0}}; NR % 2 == 0 {split($2, a, ":"); t2 = a[1]; if(cs == 1) {duration = t2 - t1} else {duration = 0}; print duration; next}'|awk '$1 > 0'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment