Authored by BuddyJack

no message

import sys
yo=0
y0=0
y1=0
y2=0
y3=0
mix=0
def analysis(gc_log):
f = open(gc_log)
global yo,y0,y1,y2,y3,mix
for line in f:
if 'GC pause (G1 Evacuation Pause) (young), 0.00' in line:
y0=y0+1
if 'GC pause (G1 Evacuation Pause) (young), 0.01' in line:
y1=y1+1
if 'GC pause (G1 Evacuation Pause) (young), 0.02' in line:
y2=y2+1
if 'GC pause (G1 Evacuation Pause) (young), 0.03' in line:
y3=y3+1
if 'GC pause (G1 Evacuation Pause) (young)' in line:
yo=yo+1
if 'GC pause (G1 Evacuation Pause) (mixed)' in line:
mix=mix+1
f.close()
if __name__=="__main__":
if len(sys.argv) != 2:
print 'Usage: python gc.log'
exit(1)
gc_log = sys.argv[1]
analysis(gc_log)
print 'young gc count:'+str(yo)+'\n'
print 'mixed gc count:'+str(mix)+'\n'
print 'gc pause < 10ms count:'+str(y0)+' in total young gc percent:'+ str(round(y0*100.0/yo,2))+'% \n'
print 'gc pause < 20ms and > 10ms count:'+str(y1)+' in total young gc percent:'+ str(round(y1*100.0/yo,2))+'% \n'
print 'gc pause < 30ms and > 20ms count:'+str(y2)+' in total young gc percent:'+ str(round(y2*100.0/yo,2))+'% \n'
print 'gc pause > 30ms count:'+str(y3)+' in total young gc percent:'+ str(round(y3*100.0/yo,2))+'% \n'
... ...