Code review request: 6855834: G1: minimize the output when -XX:+PrintHeapAtGC is set (S)

Tony Printezis Antonios.Printezis at
Tue Jul 7 08:41:43 PDT 2009


John Coomes wrote:
> Tony Printezis (Antonios.Printezis at Sun.COM) wrote:
>> The CR has more information on the new format:
> Haven't reviewed the code yet (sorry), but have some questions.
> Does G1 have reasonably accurate occupancy info when this info is
> printed?
So-and-so (and that's a good question). We do maintain how much used 
space there is in the whole heap (i.e., the sum of used() for all heap 
regions). However, we do _not_ maintain that for the young / survivor 
regions. Iterating over them just to report I think it'd be a 
performance issue.
> If so, it would be nice to have a breakdown of the amount or
> percentage used in young regions, survivor regions & old regions.
> That would be closer to the info you get for the other collectors.
Yes, you are right. I have to point out, however, that most of the time 
the young / survivor regions will be mostly full anyway (apart from the 
last survivor region!). So, region_num * region_size is a reasonably 
accurate upper bound on how much used space there is in them. But, yes, 
the more accurate version might be able potentially pathological cases 
(space being wasted in regions due to large-ish objects creating 
fragmentation). So, we should also maintain the total used space for the 
survivors and young regions (and from that deduce the used space in the 
old regions).

How about this? How about I leave this as is (i.e., with the slightly 
inaccurate information) to get it off my plate and improve the current 
-XX:+PrintHeapAtGC output (as, right now, it's overly verbose) and open 
a new CR to make it more accurate?
> If not, then I would combine the "region size" line with the one that
> follows it.  Best shown by example:
> Change this:
>  garbage-first heap   total 24576K, used 16950K [0xf2400000, 0xf3c00000, 0xf5400000)
>   region size 1024K
>   young regions 16 / 16384K  survivor regions 0 / 0K
> To something like this:
>  garbage-first heap   total 24576K, used 16950K [0xf2400000, 0xf3c00000, 0xf5400000)
>   region size 1024K, 16 young (16384K), 1 survivor (1024K)
I did consider putting them on one line and I decided against it as that 
line might get a bit long. But, you're right, the -XX:+PrintHeapAtGC 
output is not concise enough to stay within, say, 80 chars (especially 
when 64-bit addresses are involved). So, I'll use the format you're 
recommending, thanks.


| Tony Printezis, Staff Engineer   | Sun Microsystems Inc.          |
|                                  | MS UBUR02-311                  |
| e-mail: tony.printezis at   | 35 Network Drive               |
| office: +1 781 442 0998 (x20998) | Burlington, MA 01803-2756, USA |
e-mail client: Thunderbird (Linux)

More information about the hotspot-gc-dev mailing list