Monitoring Java garbage collection

I have a project in Netbeans that I am profiling (using Java 7). What I'm looking for is a garbage collection, how much memory from the Eden space goes into the Survivor space, and if there is any memory in the Tenerife space. I am also looking for how Tenured space grows with time.

I print GC statistics, but I only get this information:

2339.967: [GC 2339.967: [ParNew: 66213K->4522K(69376K), 0.0161101 secs] 284589K->223320K(369484K), 0.0161685 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 
2344.543: [GC 2344.543: [ParNew: 66218K->4520K(69376K), 0.0161084 secs] 285016K->223739K(369484K), 0.0161647 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 
2349.118: [GC 2349.118: [ParNew: 66216K->4519K(69376K), 0.0159046 secs] 285435K->224159K(369484K), 0.0159587 secs] [Times: user=0.03 sys=0.00, real=0.02 secs] 

Does anyone know a way to find the information I'm looking for?

Thanks!

+4
source share
4 answers

Here are some useful GC flags:

-XX:+PrintGCDetails 
-XX:+PrintGCTimeStamps
-XX:+PrintClassHistogram
-XX:+PrintTenuringDistribution
-XX:+PrintGCApplicationStoppedTime

-XX: + PrintTenuringDistribution should give you what you are looking for.

+8
source
+6

A jstat, (Eden, Survivor spaces) .

, .   jstat -gcutil -t <pid> <interval> <number_of_samples>

:

jstat -gcutil 21891 250 7
  S0     S1     E      O      P     YGC    YGCT    FGC    FGCT     GCT
 12.44   0.00  27.20   9.49  96.70    78    0.176     5    0.495    0.672
 12.44   0.00  62.16   9.49  96.70    78    0.176     5    0.495    0.672
 12.44   0.00  83.97   9.49  96.70    78    0.176     5    0.495    0.672
  0.00   7.74   0.00   9.51  96.70    79    0.177     5    0.495    0.673
  0.00   7.74  23.37   9.51  96.70    79    0.177     5    0.495    0.673
  0.00   7.74  43.82   9.51  96.70    79    0.177     5    0.495    0.673
  0.00   7.74  58.11   9.51  96.71    79    0.177     5    0.495    0.673

:

, 3- 4- . 0,001 eden (E) (O), 9,49% 9,51%. 12,44%, 7,74%.

- , . JVisualVM GC Java Mission Control Java 7u40.

, GC: -XX:+PrintTenuringDistribution, -XX:MaxTenuringThreshold.

+4

-XX:+PrintGCDetails, .

+1

All Articles