Skip to content

Commit

Permalink
chewiebug#155 support unified jvm logging format with tag "gc*" (leve…
Browse files Browse the repository at this point in the history
…l = trace) and decorations tags,level,time,uptime

(-Xlog:gc*=trace:file=<filename>:tags,level,time,uptime)
  • Loading branch information
chewiebug committed Feb 25, 2018
1 parent 7b19af9 commit aa4fff0
Show file tree
Hide file tree
Showing 21 changed files with 742 additions and 233 deletions.
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ When logfile rotation (-XX:+UseGCLogFileRotation) is enabled, the logfiles can b

Supported verbose:gc formats are:

- partial support for OpenJDK 9 unified logging format -Xlog:gc:<file>
- no heap information is evaluated, but all events with tag "gc" only should be recognised
- required decorations: tags,uptime (others will be ignored or parser might fail)
- some support for OpenJDK 9 unified logging format -Xlog:gc:<file>, the following configurations will work
- -Xlog:gc:file="path-to-file" (uses defaults)
- -Xlog:gc=info:file="path-to-file":tags,uptime,level (minimum configuration needed)
- -Xlog:gc*=trace:file="path-to-file":tags,time,uptime,level
(maximum configuration supported, additional tags ok, but ignored; additional decorations will break parsing)
- Oracle JDK 1.8 -Xloggc:<file> [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps]
- Sun / Oracle JDK 1.7 with option -Xloggc:<file> [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps]
- Sun / Oracle JDK 1.6 with option -Xloggc:<file> [-XX:+PrintGCDetails] [-XX:+PrintGCDateStamps]
Expand All @@ -32,7 +34,7 @@ Supported verbose:gc formats are:
- HP-UX JDK 1.2/1.3/1.4.x with the option -Xverbosegc
- BEA JRockit 1.4.2/1.5/1.6 with the option -verbose:memory [-Xverbose:gcpause,gcreport] [-Xverbosetimestamp]

Best results are achieved with: -Xloggc:<file> -XX:+PrintGCDetails -XX:+PrintGCDateStamps.
Best results for non unified gc logging Oracle JDKs are achieved with: -Xloggc:<file> -XX:+PrintGCDetails -XX:+PrintGCDateStamps.
A few other options are supported, but most of the information generated is ignored by GCViewer
(the javadoc introduction of
https://github.com/chewiebug/GCViewer/blob/master/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderSun1_6_0.java
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.io.LineNumberReader;
import java.io.UnsupportedEncodingException;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeParseException;
import java.time.temporal.ChronoUnit;
import java.util.LinkedList;
Expand All @@ -17,6 +16,7 @@
import com.tagtraum.perf.gcviewer.model.AbstractGCEvent.GcPattern;
import com.tagtraum.perf.gcviewer.model.GCEvent;
import com.tagtraum.perf.gcviewer.model.GCResource;
import com.tagtraum.perf.gcviewer.util.DateHelper;
import com.tagtraum.perf.gcviewer.util.NumberParser;
import com.tagtraum.perf.gcviewer.util.ParseInformation;

Expand All @@ -31,7 +31,6 @@
*/
public abstract class AbstractDataReaderSun extends AbstractDataReader {

public static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ");
private static final int LENGTH_OF_DATESTAMP = 29;

private static final String CMS_PRINT_PROMOTION_FAILURE = "promotion failure size";
Expand Down Expand Up @@ -433,7 +432,7 @@ protected ZonedDateTime parseDatestamp(String line, ParseInformation pos) throws
if (nextIsDatestamp(line, pos)) {
try {
zonedDateTime = ZonedDateTime.parse(line.substring(pos.getIndex(), pos.getIndex() + LENGTH_OF_DATESTAMP - 1),
DATE_TIME_FORMATTER);
DateHelper.DATE_TIME_FORMATTER);
pos.setIndex(pos.getIndex() + LENGTH_OF_DATESTAMP);
if (pos.getFirstDateStamp() == null) {
pos.setFirstDateStamp(zonedDateTime);
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderTools.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ public ExtendedType parseType(String typeString) throws UnknownGcTypeException {
public ExtendedType parseTypeWithCause(String typeName) {
typeName = typeName.trim();
ExtendedType extendedType = null;
String lookupTypeName = typeName.endsWith("--")
? typeName.substring(0, typeName.length()-2)
: typeName;
String lookupTypeName = getLookupTypeName(typeName);
AbstractGCEvent.Type gcType = AbstractGCEvent.Type.lookup(lookupTypeName);
// the gcType may be null because there was a PrintGCCause flag enabled - if so, reparse it with the first paren set stripped
if (gcType == null) {
Expand All @@ -98,5 +96,14 @@ public ExtendedType parseTypeWithCause(String typeName) {
return extendedType;
}

private String getLookupTypeName(String typeName) {
typeName = typeName.endsWith(":")
? typeName.substring(0, typeName.length()-1)
: typeName;
return typeName.endsWith("--")
? typeName.substring(0, typeName.length()-2)
: typeName;
}


}
Loading

0 comments on commit aa4fff0

Please # to comment.