Skip to content

Commit 4a09773

Browse files
committed
also accept "][safepoint" as indicator of java unified logging format
1 parent 74465b6 commit 4a09773

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderFactory.java

+3-2
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,9 @@ else if (s.contains("<AF")) {
152152
if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: IBM <1.3.0");
153153
return new DataReaderIBM1_3_0(gcResource, in);
154154
}
155-
// ...][info][gc ] Using Shenandoah <or any other gc algorithm in unified jvm logging format>
156-
else if (s.contains("][gc")) {
155+
// ...][info][gc ]
156+
// or ...][info][safepoint ] Using java unified jvm logging format
157+
else if (s.contains("][gc") || s.contains("][safepoint")) {
157158
if (getLogger().isLoggable(Level.INFO)) getLogger().info("File format: Oracle / OpenJDK unified jvm logging");
158159
return new DataReaderUnifiedJvmLogging(gcResource, in);
159160
}

src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderFactory.java

+8
Original file line numberDiff line numberDiff line change
@@ -373,4 +373,12 @@ public void testOracleShenandoahJ8Simple() throws Exception {
373373
assertDataReader(DataReaderSun1_6_0.class, dr.getClass());
374374
}
375375

376+
@Test
377+
public void testOpenJdkJulRollover() throws IOException {
378+
DataReaderFactory factory = new DataReaderFactory();
379+
DataReader dr = factory.getDataReader(new GcResourceFile("byteArray"), new ByteArrayInputStream((
380+
"[2019-09-17T20:20:29.824+0000][19.163s][info ][safepoint ] Total time for which application threads were stopped: 0.0047914 seconds, Stopping threads took: 0.0000103 seconds\n\n").getBytes()));
381+
assertDataReader(DataReaderUnifiedJvmLogging.class, dr.getClass());
382+
}
383+
376384
}

0 commit comments

Comments
 (0)