Skip to content

Instantly share code, notes, and snippets.

@aminamid
Created May 22, 2015 07:19
Show Gist options
  • Save aminamid/31cf97f58be254093112 to your computer and use it in GitHub Desktop.
Save aminamid/31cf97f58be254093112 to your computer and use it in GitHub Desktop.
jvm GC sed
sed -e ':a;N;s/\([^s]\)\n/\1#/;t a;P;D;' | sed -e 's/\] \?#{H/ \n{H/' | sed -r 's/.*par new generation\s+total [0-9]+K, used ([0-9]+)K .*#\s+concurrent mark-sweep generation total [0-9]+K, used ([0-9]+)K .*#\s+concurrent-mark-sweep perm gen total [0-9]+K, used ([0-9]+)K .*#(....\-..\-..T..:..:..\....)\+....:.*# par new generation\s+total [0-9]+K, used ([0-9]+)K .*#\s+concurrent mark-sweep generation total [0-9]+K, used ([0-9]+)K .*#\s+concurrent-mark-sweep perm gen total [0-9]+K, used ([0-9]+)K [^}]+*#}#(....\-..\-..T..:..:..\....).*/ParNewBEGIN \4 \1 \2 \3#ParNewEND \8 \5 \6 \7/'| sed 's/#/\n/g' | grep ParNew
echo "event time new old parm"
sed -e ':a;N;s/\([^s]\)\n/\1#/;t a;P;D;' | sed -e 's/\] \?#{H/ \n{H/' | sed -r 's/^\{Heap before GC invocations=[0-9]+ \([^)]+\):#\s+par new generation\s+total [0-9]+K, used ([0-9]+)K \[[^)]+\)#\s+eden space [0-9]+K,\s+[0-9]+% used \[[^)]+\)#\s+from space [0-9]+K,\s+[0-9]+% used \[[^)]+\)#\s+to space [0-9]+K,\s+[0-9]+% used \[[^)]+\)#\s+concurrent mark-sweep generation total [0-9]+K, used ([0-9]+)K \[[^)]+\)#\s+concurrent-mark-sweep perm gen total [0-9]+K, used ([0-9]+)K \[[^)]+\)#(....\-..\-..T..:..:..\....)\+....:.* invocations=[0-9]+ \([^)]+\):# par new generation\s+total [0-9]+K, used ([0-9]+)K \[[^)]+\)#\s+eden space [0-9]+K,\s+[0-9]+% used \[[^)]+\)#\s+from space [0-9]+K,\s+[0-9]+% used \[[^)]+\)#\s+to space [0-9]+K,\s+[0-9]+% used \[[^)]+\)#\s+concurrent mark-sweep generation total [0-9]+K, used ([0-9]+)K \[[^)]+\)#\s+concurrent-mark-sweep perm gen total [0-9]+K, used ([0-9]+)K \[[^)]+\)#}#(....\-..\-..T..:..:..\....).*/ParNewBEGIN \4 \1 \2 \3#ParNewEND \8 \5 \6 \7/'| sed 's/#/\n/g' | grep ParNew
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment