Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fail to recognize jdk11 printgc gclog format #245

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class GCLogParserFactory {
new ParserMetadataRule(": [GC", PRE_UNIFIED, GCCollectorType.UNKNOWN),
new ParserMetadataRule("[info]", UNIFIED, GCCollectorType.UNKNOWN),
new ParserMetadataRule("[gc]", UNIFIED, GCCollectorType.UNKNOWN),
new ParserMetadataRule("] GC(", UNIFIED, GCCollectorType.UNKNOWN),

// collector
new ParserMetadataRule("PSYoungGen", GCLogStyle.UNKNOWN, PARALLEL),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1067,6 +1067,7 @@ public void testJDK8CMSPrintGC() throws Exception {
}
}

@Test
public void testJDK11G1PrintGC() throws Exception {

GCLogParser parser = new GCLogParserFactory().getParser(TestUtil.getGCLog("11G1PrintGC.log"));
Expand All @@ -1088,6 +1089,20 @@ public void testJDK11G1PrintGC() throws Exception {
Assertions.assertEquals(2, event.getPhases().size());
}
}

parser = new GCLogParserFactory().getParser(TestUtil.getGCLog("11G1PrintGC2.log"));
model = (G1GCModel) parser.parse(TestUtil.getGCLog("11G1PrintGC2.log"));
model.calculateDerivedInfo(new DefaultProgressListener());

Assertions.assertEquals(model.getGcEvents().stream().filter(GCEvent::isYoungGC).count(), 4);
Assertions.assertEquals(model.getGcEvents().stream().filter(GCEvent::isOldGC).count(), 0);
Assertions.assertEquals(model.getGcEvents().stream().filter(GCEvent::isFullGC).count(), 0);
for (GCEvent event : model.getGcEvents()) {
Assertions.assertTrue(event.isYoungGC());
Assertions.assertTrue(event.getDuration() > 0);
Assertions.assertNotNull(event.getCause());
Assertions.assertNotNull(event.getMemoryItem(HEAP));
}
}

@Test
Expand Down
4 changes: 4 additions & 0 deletions analysis/gc-log/src/test/resources/11G1PrintGC2.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[2023-12-03T00:00:09.884+0800] GC(22892) Pause Young (Normal) (G1 Evacuation Pause) 7816M->4804M(9728M) 52.476ms
[2023-12-03T00:00:23.112+0800] GC(22893) Pause Young (Normal) (G1 Evacuation Pause) 7812M->4825M(9728M) 44.257ms
[2023-12-03T00:00:37.770+0800] GC(22894) Pause Young (Normal) (G1 Evacuation Pause) 7817M->4830M(9728M) 44.456ms
[2023-12-03T00:00:52.638+0800] GC(22895) Pause Young (Normal) (G1 Evacuation Pause) 7822M->4832M(9728M) 45.218ms