From e76f8a72916c25a55a33e1135b76b792b928d7ea Mon Sep 17 00:00:00 2001 From: cuiweilong Date: Mon, 22 Aug 2022 17:46:54 +0800 Subject: [PATCH] add "[gc,init" to LOG_ONLY_STRINGS --- .../perf/gcviewer/imp/DataReaderSun1_6_0.java | 1 + .../perf/gcviewer/imp/DataReaderTools.java | 2 +- .../imp/DataReaderUnifiedJvmLogging.java | 34 +++++++++++-------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderSun1_6_0.java b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderSun1_6_0.java index 72e1a56c..3b3385af 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderSun1_6_0.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderSun1_6_0.java @@ -273,6 +273,7 @@ public DataReaderSun1_6_0(GCResource gcResource, InputStream in, GcLogType gcLog public GCModel read() throws IOException { if (getLogger().isLoggable(Level.INFO)) getLogger().info("Reading Sun / Oracle 1.4.x / 1.5.x / 1.6.x / 1.7.x / 1.8.x format..."); + try (LineNumberReader in = this.in) { GCModel model = new GCModel(); model.setFormat(GCModel.Format.SUN_X_LOG_GC); diff --git a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderTools.java b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderTools.java index 883b9d61..e7d2085f 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderTools.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderTools.java @@ -69,7 +69,7 @@ public ExtendedType parseType(String typeString) throws UnknownGcTypeException { } /** - * Same as @{link {@link #parseType(String)}}, but returns null instead of exception, if no type could + * Same as {@link #parseType(String)}, but returns null instead of exception, if no type could * be found. * * @param typeName string representation of the gc event diff --git a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderUnifiedJvmLogging.java b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderUnifiedJvmLogging.java index 412585db..47489aa2 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderUnifiedJvmLogging.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderUnifiedJvmLogging.java @@ -90,22 +90,24 @@ public class DataReaderUnifiedJvmLogging extends AbstractDataReader { private static final int GROUP_PAUSE = 1; // Input: 4848M->4855M(4998M) - // Group 1: 4848 - // Group 2: M - // Group 3: 4855 - // Group 4: M - // Group 5: 4998 - // Group 6: M + // Group 1: 4848M->4855M(4998M) + // Group 2: 4848 + // Group 3: M + // Group 4: 4855 + // Group 5: M + // Group 6: 4998 + // Group 7: M private static final Pattern PATTERN_MEMORY = Pattern.compile("^" + PATTERN_MEMORY_STRING); // Input: 4848M->4855M(4998M) 2.872ms - // Group 1: 4848 - // Group 2: M - // Group 3: 4855 - // Group 4: M - // Group 5: 4998 - // Group 6: M - // Group 7: 2.872 (optional group) + // Group 1: 4848M->4855M(4998M) + // Group 2: 4848 + // Group 3: M + // Group 4: 4855 + // Group 5: M + // Group 6: 4998 + // Group 7: M + // Group 8: 2.872 (optional group) private static final Pattern PATTERN_MEMORY_PAUSE = Pattern.compile("^" + PATTERN_MEMORY_STRING + "(?:(?:[ ]" + PATTERN_PAUSE_STRING + ")|$)"); private static final int GROUP_MEMORY = 1; @@ -161,10 +163,11 @@ public class DataReaderUnifiedJvmLogging extends AbstractDataReader { private static final String TAG_GC_HEAP = "gc,heap"; private static final String TAG_GC_METASPACE = "gc,metaspace"; private static final String TAG_GC_PHASES = "gc,phases"; + private static final String TAG_GC_INIT = "gc,init"; private static final String TAG_SAFEPOINT = "safepoint"; /** list of strings, that must be part of the gc log line to be considered for parsing */ - private static final List INCLUDE_STRINGS = Arrays.asList("[gc ", "[gc]", "[" + TAG_GC_START, "[" + TAG_GC_HEAP, "[" + TAG_GC_METASPACE, "[" + TAG_GC_PHASES, Type.APPLICATION_STOPPED_TIME.getName(), "Heap Region Size"); + private static final List INCLUDE_STRINGS = Arrays.asList("[gc ", "[gc]", "[" + TAG_GC_START, "[" + TAG_GC_HEAP, "[" + TAG_GC_METASPACE, "[" + TAG_GC_PHASES, "[" + TAG_GC_INIT, Type.APPLICATION_STOPPED_TIME.getName()); /** list of strings, that target gc log lines, that - although part of INCLUDE_STRINGS - are not considered a gc event */ private static final List EXCLUDE_STRINGS = Arrays.asList("Cancelling concurrent GC", "[debug", @@ -198,7 +201,8 @@ public class DataReaderUnifiedJvmLogging extends AbstractDataReader { "Heap Region Size", // jdk 17 "Consider", "Heuristics ergonomically sets", - "Soft Max Heap Size" // ShenandoahGC + "Soft Max Heap Size", // ShenandoahGC + "[gc,init" ); protected DataReaderUnifiedJvmLogging(GCResource gcResource, InputStream in) throws UnsupportedEncodingException {