This Java library provides a parser for the GC logs produced by Oracle JDK 1.7 and 1.8. It includes a command line utility to generate CSV files from the logs. Your can load them in your favorite tool for analysis then. See the following inspiring article as an example - Using R to analyze Java G1 garbage collector log files.
The library requires Java 1.8.
The library is able to parse the logs produced by using the key GC logging options:
- -XX:+PrintGC (or -verbose:gc)
- -XX:+PrintGCDetails
- -XX:+PrintGCTimeStamps
- -XX:+PrintGCDateStamps
The following Oracle JVM's garbage collectors are supported:
Generation | Collector | JVM Option |
New | Copy | -XX:+UseSerialGC |
PS Scavenge | -XX:+UseParallelGC | |
ParNew | -XX:+UseParNewGC | |
G1 Young | -XX:+UseG1GC | |
Old | MarkSweepCompact | -XX:+UseSerialGC |
PS MarkSweep | -XX:+UseParallelGC -XX:+UseParallelOldGC | |
ConcurrentMarkSweep (except iCMS) | -XX:+UseConcMarkSweepGC | |
G1 Mixed | -XX:+UseG1GC |
The parser tries to extract as much information as possible from the log files. All possible fields that may present in the result CSV files are described in the table below. Exact subset of these fields depends on the GC options being used.
Field | Description |
---|---|
Type | Type of the GC pause event. Possible values are:
|
Date | Date/time of the GC event |
Time | Time passed since JVM start (in seconds) |
PauseTime | GC pause time (in seconds) |
UserPauseTime | CPU time spent in user space (in seconds) |
SysPauseTime | CPU time spent in kernel space (in seconds) |
RealPauseTime | Real time (in seconds) spent by GC (rounded value of PauseTime) |
NewGenPauseTime | Time spent to collect young generation (in seconds) |
OldGenPauseTime | Time spent to collect old generation (in seconds) |
MemBefore | Used heap memory before GC run |
MemAfter | Used heap memory after GC run |
MemTotal | Overall allocated heap memory |
NewMemBefore | Used young generation space before GC run |
NewMemAfter | Used young generation space after GC run |
NewMemTotal | Overall allocated young generation space |
EdenMemBefore | Used Eden space before GC run |
EdenMemAfter | Used Eden space after GC run |
EdenMemTotal | Overall allocated Eden space |
SurvivorMemBefore | Used Survivor space before GC run |
SurvivorMemAfter | Used Survivor space after GC run |
OldMemBefore | Used old generation space before GC run |
OldMemAfter | Used old generation space after GC run |
OldMemTotal | Overall allocated old generation space |
PermMemBefore | Used permanent generation space before GC run |
PermMemAfter | Used permanent generation space after GC run |
PermMemTotal | Overall allocated permanent space |
MetaspaceMemBefore | Used metaspace before GC run (since Java 8) |
MetaspaceMemAfter | Used metaspace after GC run (since Java 8) |
MetaspaceMemTotal | Overall allocated metaspace (since Java 8) |
ConcurrentPhase | Stop-the-world phase of the concurrent old collector |
Memory-related fields are extracted as is and measured either in Kylobytes or Megabytes.
Run Maven command to build a JAR file:
mvn clean install
Licensed under the Apache License 2.0.