推荐一个GC日志分析工具: PrintGCStats

一个用shell写成的GC日志分析工具,用于进行各种统计,非常小巧好用。

下载:
点这里

使用:

./PrintGCStats -v cpus=4 ~/temp/gc.log #cpus代表逻辑cpu数

样例输出:

引用

what           count          total          mean           max     stddev

gen0(s)            4         15.606       3.90150        11.344     5.0888

gen0t(s)           4         15.607       3.90169        11.344     5.0888

cmsIM(s)         225        740.826       3.29256         3.908     0.3529

cmsRM(s)         224        654.354       2.92122         3.570     0.3063

GC(s)            229       1410.787       6.16064        11.344    -1.0000

cmsCM(s)         224        960.213       4.28667         6.262     0.1990

cmsCP(s)         448       1151.485       2.57028         6.529     2.5872

cmsCS(s)         224        260.473       1.16283         5.056     0.3797

cmsCR(s)         224          3.147       0.01405         0.031     0.0012

alloc(MB)          4       6796.764    1699.19092      1706.750    15.1182

promo(MB)          4       1877.995     469.49878       878.894   399.3327

used0(MB)          4       7173.320    1793.33008      1877.375    97.0688

used(MB)           4       8882.401    2220.60034      2876.477   602.1023

commit0(MB)        4       7509.500    1877.37500      1877.375     0.0000

commit1(MB)        4       8192.000    2048.00000      2048.000     0.0000

commit(MB)         4      15701.500    3925.37500      3925.375     0.0000

alloc/elapsed_time    =   6796.764 MB /   4298.246 s  =   1.581 MB/s

alloc/tot_cpu_time    =   6796.764 MB /  17192.984 s  =   0.395 MB/s

alloc/mut_cpu_time    =   6796.764 MB /   9174.519 s  =   0.741 MB/s

promo/elapsed_time    =   1877.995 MB /   4298.246 s  =   0.437 MB/s

promo/gc0_time        =   1877.995 MB /     15.607 s  = 120.332 MB/s

gc_seq_load           =   5643.147 s  /  17192.984 s  =  32.822%

gc_conc_load          =   2375.318 s  /  17192.984 s  =  13.816%

gc_tot_load           =   8018.465 s  /  17192.984 s  =  46.638%

字段解释:

引用

# gen0(s)     – young gen collection time, excluding gc_prologue & gc_epilogue.

# gen0t(s)    – young gen collection time, including gc_prologue & gc_epilogue

# gen1i(s)    – train generation incremental collection

# gen1t(s)    – old generation collection/full GC

# cmsIM(s)    – CMS initial mark pause

# cmsRM(s)    – CMS remark pause

# cmsRS(s)    – CMS resize pause

# GC(s)       – all stop-the-world GC pauses

# cmsCM(s)    – CMS concurrent mark phase

# cmsCP(s)    – CMS concurrent preclean phase

# cmsCS(s)    – CMS concurrent sweep phase

# cmsCR(s)    – CMS concurrent reset phase

# alloc(MB)   – object allocation in MB (approximate***)

# promo(MB)   – object promotion in MB (approximate***)

# used0(MB)   – young gen used memory size (before gc)

# used1(MB)   – old gen used memory size (before gc)

# used(MB)    – heap space used memory size (before gc) (excludes perm gen)

# commit0(MB) – young gen committed memory size (after gc)

# commit1(MB) – old gen committed memory size (after gc)

# commit(MB)  – heap committed memory size (after gc) (excludes perm gen)

# apptime(s)  – amount of time application threads were running

# safept(s)   – amount of time the VM spent at safepoints (app threads stopped)

# alloc/elapsed_time – allocation rate, based on elapsed time

# alloc/tot_cpu_time – allocation rate, based on total cpu time

# alloc/mut_cpu_time – allocation rate, based on cpu time available to mutators

# promo/elapsed_time – promotion rate, based on elapsed time

# promo/gc0_time     – promotion rate, based on young gen gc time

# gc_seq_load        – the percentage of cpu cycles used by gc ‘serially’

#                      (i.e., while java application threads are stopped)

# gc_conc_load       – the percentage of cpu cycles used by gc ‘concurrently’

#                      (i.e., while java application threads are also running)

# gc_tot_load        – the percentage of cpu cycles spent in gc

Leave a Comment

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.