Last active
January 4, 2021 06:58
-
-
Save justdoit0823/80b959fd48761953e4f7a555b8faf594 to your computer and use it in GitHub Desktop.
Stat g1 allocation rate in jvm 8 with awk.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
awk '/GC pause/ || /Heap:/ {if($0 ~ /GC pause/) {split($2, a, ":"); print a[1];} else {print $NF}}' gc.log|awk 'NR % 4 == 1 {s1 = $0}; NR % 4 == 2 {split($NF, a, "("); split(a[2], b, "->"); h1 = substr(b[2], 1, length(b[2]) -1); if(b[2] ~ /G$/) {h1 = h1 * 1024}}; NR % 4 == 3 {s2 = $0}; NR % 4 == 0 {split($NF, a, "("); h2 = substr(a[1], 1, length(a[1]) -1); if(a[1] ~ /G$/) {h2 = h2 * 1024}; duration = s2 - s1; heap = h2 - h1; print s2, duration, heap / duration; next}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment