G1 log traces: rounding errors!

Thomas Schatzl thomas.schatzl at oracle.com
Sun Nov 3 03:16:00 PST 2013


On Sat, 2013-11-02 at 22:15 +0000, Andreas Müller wrote:
> Hi all,
>  
> has anybody ever noticed that the G1 collector (in Java 7 with larger
> heaps) writes gc.log traces like that:
>
> 433.966: [GC pause (young) 13G->12G(16G), 0.0431884 secs]
>
> I am a bit concerned about the rounding errors when I use those traces
> to do a quantitative analysisL

These problems are known.

> What about that GC trace line:
>
> 417.747: [GC pause (young) 12G->12G(16G), 0.0443063 secs]
>
> I am sure that the collector did some work here, but any meaningful
> parsing of that line must come to the conclusion that 0 bytes of heap
> have been freed.
>
> On the other hand, I find traces like this one:
>
> 48.809: [GC pause (young) 10G->9981M(16G), 0.0607958 secs]
> 
> Is there any information about the rounding policy in these traces?

globalDefinitions.hpp, line 210:

template <class T>
inline T byte_size_in_proper_unit(T s) {
#ifdef _LP64
  if (s >= 10*G) {
    return (T)(s/G);
  }
#endif
  if (s >= 10*M) {
    return (T)(s/M);
  } else if (s >= 10*K) {
    return (T)(s/K);
  } else {
    return s;
  }
}

where G/M/K are 2^30/2^20/2^10 respectively.

Probably it would be better to make sure to preserve more digits in
these messages and do better rounding.

Thomas




More information about the hotspot-gc-use mailing list