Showing
1 changed file
with
41 additions
and
0 deletions
analysis_gc.py
0 → 100644
1 | +import sys | ||
2 | + | ||
3 | +yo=0 | ||
4 | +y0=0 | ||
5 | +y1=0 | ||
6 | +y2=0 | ||
7 | +y3=0 | ||
8 | +mix=0 | ||
9 | + | ||
10 | + | ||
11 | +def analysis(gc_log): | ||
12 | + f = open(gc_log) | ||
13 | + global yo,y0,y1,y2,y3,mix | ||
14 | + for line in f: | ||
15 | + if 'GC pause (G1 Evacuation Pause) (young), 0.00' in line: | ||
16 | + y0=y0+1 | ||
17 | + if 'GC pause (G1 Evacuation Pause) (young), 0.01' in line: | ||
18 | + y1=y1+1 | ||
19 | + if 'GC pause (G1 Evacuation Pause) (young), 0.02' in line: | ||
20 | + y2=y2+1 | ||
21 | + if 'GC pause (G1 Evacuation Pause) (young), 0.03' in line: | ||
22 | + y3=y3+1 | ||
23 | + if 'GC pause (G1 Evacuation Pause) (young)' in line: | ||
24 | + yo=yo+1 | ||
25 | + if 'GC pause (G1 Evacuation Pause) (mixed)' in line: | ||
26 | + mix=mix+1 | ||
27 | + f.close() | ||
28 | + | ||
29 | + | ||
30 | +if __name__=="__main__": | ||
31 | + if len(sys.argv) != 2: | ||
32 | + print 'Usage: python gc.log' | ||
33 | + exit(1) | ||
34 | + gc_log = sys.argv[1] | ||
35 | + analysis(gc_log) | ||
36 | + print 'young gc count:'+str(yo)+'\n' | ||
37 | + print 'mixed gc count:'+str(mix)+'\n' | ||
38 | + print 'gc pause < 10ms count:'+str(y0)+' in total young gc percent:'+ str(round(y0*100.0/yo,2))+'% \n' | ||
39 | + print 'gc pause < 20ms and > 10ms count:'+str(y1)+' in total young gc percent:'+ str(round(y1*100.0/yo,2))+'% \n' | ||
40 | + print 'gc pause < 30ms and > 20ms count:'+str(y2)+' in total young gc percent:'+ str(round(y2*100.0/yo,2))+'% \n' | ||
41 | + print 'gc pause > 30ms count:'+str(y3)+' in total young gc percent:'+ str(round(y3*100.0/yo,2))+'% \n' |
-
Please register or login to post a comment