analysis_gc.py
1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
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'