1

The G1GC logging is printing Heap occupation values as rounded to MB or GB, is there a way how to print all values in KB or MB?

I want to analyze Allocation and Promotion Rates and this rounding of values introduces imprecision.

For example a GC event below shows total heap occupation being reduced from 11.7G->1826.2M which shows only a rounded value of 11.7G for total heap size prior the collection.

4592.204: [GC pause (G1 Evacuation Pause) (young)
  [Eden: 9804.0M(9804.0M)->0.0B(9800.0M) Survivors: 112.0M->86.0M 
  Heap: 11.7G(15.0G)->1826.2M(15.0G)]
  ...

VM flags used:

-Xms16g -Xmx16g -XX:+UseG1GC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:gc.log

Using Hotspot JVM 1.8.0-b132.

Aleš
  • 8,896
  • 8
  • 62
  • 107

1 Answers1

3

See the source code to OpenJDK 7u hotspot here and here.

Both points use the methods byte_size_in_proper_unit and proper_unit_for_byte_size located here.

I believe the only way to modify the G1GC logs from PrintGCDetails or PrintGC is to recompile the JVM and that can only be done with OpenJDK and not Oracle's JVM.

See the follow stackoverflow post for more information about the output format.

You can also use a tool like jstat with the options -gc and -gcnew for the data in G1GC logs, sampled at different times in KB only, see here for more information regarding jstat usage. If you wanted to write a similar tool to Jstat, the source is located here.

Community
  • 1
  • 1
Appleman1234
  • 15,946
  • 45
  • 67