United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6855834 G1: minimize the output when -XX:+PrintHeapAtGC is set
JDK-6855834 : G1: minimize the output when -XX:+PrintHeapAtGC is set

Details
Type:
Enhancement
Submit Date:
2009-06-29
Status:
Resolved
Updated Date:
2010-04-04
Project Name:
JDK
Resolved Date:
2009-07-15
Component:
hotspot
OS:
generic
Sub-Component:
gc
CPU:
generic
Priority:
P4
Resolution:
Fixed
Affected Versions:
hs16
Fixed Versions:
hs16 (b06)

Related Reports
Backport:
Backport:
Relates:

Sub Tasks

Description
When -XX:+PrintHeapAtGC is set we call the print() method on G1CollectedHeap. This dumps the heap contents, one region at a time, which is overkill and makes the G1 verbose GC output unnecessarily long. We should make the -XX:+PrintHeapAtGC output more concise.

                                    

Comments
EVALUATION

See Description.
                                     
2009-06-29
SUGGESTED FIX

Instead of dumping information for all regions, the new format looks like this:

{Heap before GC invocations=14 (full 4):
 garbage-first heap   total 24576K, used 16950K [0xf2400000, 0xf3c00000, 0xf5400000)
  region size 1024K
  young regions 16 / 16384K  survivor regions 0 / 0K
 compacting perm gen  total 16384K, used 3077K [0xf5400000, 0xf6400000, 0xf9400000)
   the space 16384K,  18% used [0xf5400000, 0xf57014c0, 0xf5701600, 0xf6400000)
No shared spaces configured.
18.050: [GC pause (young) 16M->7684K(26M), 0.0515459 secs]
Heap after GC invocations=15 (full 4):
 garbage-first heap   total 31744K, used 7684K [0xf2400000, 0xf4300000, 0xf5400000)
  region size 1024K
  young regions 7 / 7168K  survivor regions 7 / 7168K
 compacting perm gen  total 16384K, used 3077K [0xf5400000, 0xf6400000, 0xf9400000)
   the space 16384K,  18% used [0xf5400000, 0xf57014c0, 0xf5701600, 0xf6400000)
No shared spaces configured.
}

However, I have left in the ability to dump the extended per-region information, guarded by the new flag -XX:+PrintHeapAtGCExtended, given that it might be helpful for debugging.

I also fixed a few small related things in the code:

- passing the right boolean when calling increment_total_collections() (in the case of Full GC, the code before was not increasing the full GC counter)
- moved the print_heap_before_gc() / print_heap_after_gc() calls from the gc_prologue() / gc_epilogue() methods to the methods that performance the collection, since the bracketing before was wrong.
                                     
2009-07-06
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot-gc/hotspot/rev/0316eac49d5a
                                     
2009-07-08
SUGGESTED FIX

I updated the format based on comments from John Coomes. Basically, I put region size and number of young / survivor regions on the same line and slightly changed their format.

{Heap before GC invocations=12 (full 3):
garbage-first heap   total 26624K, used 22004K [0xf2400000, 0xf3e00000, 0xf5400000)
 region size 1024K, 16 young (16384K), 2 survivors (2048K)
compacting perm gen  total 16384K, used 3070K [0xf5400000, 0xf6400000, 0xf9400000)
  the space 16384K,  18% used [0xf5400000, 0xf56ffa68, 0xf56ffc00, 0xf6400000)
No shared spaces configured.
15.982: [GC pause (young) 21M->9990K(28M), 0.1216863 secs]
Heap after GC invocations=13 (full 3):
garbage-first heap   total 28672K, used 9990K [0xf2400000, 0xf4000000, 0xf5400000)
 region size 1024K, 4 young (4096K), 4 survivors (4096K)
compacting perm gen  total 16384K, used 3070K [0xf5400000, 0xf6400000, 0xf9400000)
  the space 16384K,  18% used [0xf5400000, 0xf56ffa68, 0xf56ffc00, 0xf6400000)
No shared spaces configured.
}
{Heap before GC invocations=13 (full 3):
garbage-first heap   total 28672K, used 21584K [0xf2400000, 0xf4000000, 0xf5400000)
 region size 1024K, 16 young (16384K), 4 survivors (4096K)
compacting perm gen  total 16384K, used 3077K [0xf5400000, 0xf6400000, 0xf9400000)
  the space 16384K,  18% used [0xf5400000, 0xf57016b8, 0xf5701800, 0xf6400000)
No shared spaces configured.
16.570: [Full GC (System.gc()) 21M->566K(24M), 0.1898490 secs]
Heap after GC invocations=14 (full 4):
garbage-first heap   total 24576K, used 566K [0xf2400000, 0xf3c00000, 0xf5400000)
 region size 1024K, 0 young (0K), 0 survivors (0K)
compacting perm gen  total 16384K, used 3075K [0xf5400000, 0xf6400000, 0xf9400000)
  the space 16384K,  18% used [0xf5400000, 0xf5700dd0, 0xf5700e00, 0xf6400000)
No shared spaces configured.
}
                                     
2009-07-08
EVALUATION

http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/0316eac49d5a
                                     
2009-07-11



Hardware and Software, Engineered to Work Together