From fe602b459c21190ac17692871d7219af893beb73 Mon Sep 17 00:00:00 2001 From: chewiebug Date: Tue, 13 Dec 2022 19:00:24 +0100 Subject: [PATCH] cleanup tests following suggestions of cuiweilong --- README.md | 2 +- .../gcviewer/imp/DataReaderIBM_J9_R28.java | 3 +- .../perf/gcviewer/model/AbstractGCEvent.java | 5 +- .../gcviewer/imp/TestDataReaderSun1_8_0.java | 122 +----------------- ...leOpenJdk1_8_0-171-ShenandoahBeginning.txt | 38 ------ ...leOpenJdk1_8_0-232-ShenandoahBeginning.txt | 27 ---- 6 files changed, 7 insertions(+), 190 deletions(-) delete mode 100644 src/test/resources/openjdk/SampleOpenJdk1_8_0-171-ShenandoahBeginning.txt delete mode 100644 src/test/resources/openjdk/SampleOpenJdk1_8_0-232-ShenandoahBeginning.txt diff --git a/README.md b/README.md index 5a0ae65a..fb29385a 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ GCViewer 1.36 [![Build Status](https://app.travis-ci.com/chewiebug/GCViewer.svg?branch=develop)](https://app.travis-ci.com/chewiebug/GCViewer) [![codecov.io](https://codecov.io/github/chewiebug/GCViewer/coverage.svg?branch=develop)](https://codecov.io/github/chewiebug/GCViewer?branch=develop) -[![Download gcviewer](https://img.shields.io/sourceforge/dm/gcviewer.svg)](https://sourceforge.net/projects/gcviewer/files/latest/download) +[![Download gcviewer](https://img.shields.io/sourceforge/dm/gcviewer.svg)](https://sourceforge.net/projects/gcviewer/files) GCViewer is a little tool that visualizes verbose GC output generated by Sun / Oracle, IBM, HP and BEA Java Virtual Machines. It diff --git a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderIBM_J9_R28.java b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderIBM_J9_R28.java index 489dd487..1b5b53c1 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderIBM_J9_R28.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/imp/DataReaderIBM_J9_R28.java @@ -20,6 +20,7 @@ import javax.xml.stream.events.XMLEvent; import com.tagtraum.perf.gcviewer.model.AbstractGCEvent; +import com.tagtraum.perf.gcviewer.model.AbstractGCEvent.ExtendedType; import com.tagtraum.perf.gcviewer.model.AbstractGCEvent.Type; import com.tagtraum.perf.gcviewer.model.GCEvent; import com.tagtraum.perf.gcviewer.model.GCModel; @@ -92,7 +93,7 @@ public GCModel read() throws IOException { break; case EXCLUSIVE_END: handleExclusiveEnd(startElement, currentGcEvent); - if (currentGcEvent.getExtendedType() == null) { + if (currentGcEvent.getExtendedType() == null || currentGcEvent.getExtendedType() == ExtendedType.UNDEFINED) { if (getLogger().isLoggable(Level.FINE)) getLogger().fine("event at " + in.getLineNumber() + " doesn't contain any information, the parser can handle"); } diff --git a/src/main/java/com/tagtraum/perf/gcviewer/model/AbstractGCEvent.java b/src/main/java/com/tagtraum/perf/gcviewer/model/AbstractGCEvent.java index 040b7d83..8a3d8cf6 100644 --- a/src/main/java/com/tagtraum/perf/gcviewer/model/AbstractGCEvent.java +++ b/src/main/java/com/tagtraum/perf/gcviewer/model/AbstractGCEvent.java @@ -368,7 +368,7 @@ public static class ExtendedType implements Serializable { static { WRAPPER_MAP.put(Type.UNDEFINED.getName(), new ExtendedType(Type.UNDEFINED)); } - public static final ExtendedType UNDEFINED = WRAPPER_MAP.get(Type.UNDEFINED); + public static final ExtendedType UNDEFINED = WRAPPER_MAP.get(Type.UNDEFINED.getName()); private String fullName; private Type type; @@ -683,7 +683,8 @@ public String toString() { public static final Type UJL_G1_PHASE_COMPACT_HEAP = new Type("Phase 4: Compact heap", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE); // unified jvm logging shenandoah event types - // Only "Concurrent cleanup", "Concurrent uncommit", "Pause Degenerated GC", "Pause Full" event types have memory info + // shenandoah in the earlier jdk1.8 versions had more events with GC_MEMORY_PAUSE patterns. Those versions are not supported any more, breaking + // backwards compatibility of the parser. If that backwards compatibility should be needed, more flexibility will have to be built into it. public static final Type UJL_SHEN_PAUSE_INIT_MARK = new Type("Pause Init Mark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE); public static final Type UJL_SHEN_PAUSE_FINAL_MARK = new Type("Pause Final Mark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE); public static final Type UJL_SHEN_PAUSE_INIT_UPDATE_REFS = new Type("Pause Init Update Refs", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE); diff --git a/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderSun1_8_0.java b/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderSun1_8_0.java index 02846ed2..3fa8f90d 100644 --- a/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderSun1_8_0.java +++ b/src/test/java/com/tagtraum/perf/gcviewer/imp/TestDataReaderSun1_8_0.java @@ -16,10 +16,10 @@ import com.tagtraum.perf.gcviewer.UnittestHelper.FOLDER; import com.tagtraum.perf.gcviewer.model.AbstractGCEvent; import com.tagtraum.perf.gcviewer.model.AbstractGCEvent.Type; -import com.tagtraum.perf.gcviewer.util.DateHelper; import com.tagtraum.perf.gcviewer.model.GCModel; import com.tagtraum.perf.gcviewer.model.GCResource; import com.tagtraum.perf.gcviewer.model.GcResourceFile; +import com.tagtraum.perf.gcviewer.util.DateHelper; import org.junit.Test; /** @@ -221,86 +221,6 @@ public void shenandoahPauseUpdateRefs() throws Exception { assertThat("Pause Final Update Refs: duration", finalUpdateRefsEvent.getPause(), closeTo(0.000291, 0.00001)); } -// FIX ME! Only "Concurrent cleanup", "Concurrent uncommit", "Pause Degenerated GC", "Pause Full" event types have memory info -// @Test -// public void shehandoahConcurrentEventsjsk8u171() throws Exception { -// // FIX ME! I think the test is overtime and need removed, alert the log string for build success. -// // probably jdk8u171 -// TestLogHandler handler = new TestLogHandler(); -// handler.setLevel(Level.WARNING); -// GCResource gcResource = new GcResourceFile("byteArray"); -// gcResource.getLogger().addHandler(handler); -// -// ByteArrayInputStream in = new ByteArrayInputStream( -// ("13.979: [Concurrent marking 1435M->1447M(2048M), 12.576 ms]" + -// "\n13.994: [Concurrent evacuation 684M->712M(2048M), 6.041 ms]" + -// "\n14.001: [Concurrent update references 713M->726M(2048M), 14.718 ms]" + -// "\n14.017: [Concurrent reset bitmaps 60M->62M(2048M), 0.294 ms]" + -// "\n626.259: [Cancel concurrent mark, 0.056 ms]\n") -// .getBytes()); -// -// DataReader reader = new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_8); -// GCModel model = reader.read(); -// -// assertThat("gc count", model.size(), is(5)); -// assertThat("warnings", handler.getCount(), is(0)); -// -// AbstractGCEvent concurrentMarking = model.get(0); -// assertThat("Concurrent Marking: name", concurrentMarking.getTypeAsString(), equalTo("Concurrent marking")); -// assertThat("Concurrent Marking: duration", concurrentMarking.getPause(), closeTo(0.012576, 0.0000001)); -// assertThat("Concurrent Marking: before", concurrentMarking.getPreUsed(), is(1435 * 1024)); -// assertThat("Concurrent Marking: after", concurrentMarking.getPostUsed(), is(1447 * 1024)); -// assertThat("Concurrent Marking: total", concurrentMarking.getTotal(), is(2048 * 1024)); -// } -// -// @Test -// public void shehandoahConcurrentEventsjsk8u232() throws Exception { -// TestLogHandler handler = new TestLogHandler(); -// handler.setLevel(Level.WARNING); -// GCResource gcResource = new GcResourceFile("byteArray"); -// gcResource.getLogger().addHandler(handler); -// -// ByteArrayInputStream in = new ByteArrayInputStream( -// ("0.233: [Concurrent reset, start]\n" + -// " Using 2 of 2 workers for concurrent reset\n" + -// "0.234: [Concurrent reset 32854K->32983K(34816K), 0.401 ms]\n" + -// "0.237: [Concurrent marking (process weakrefs), start]\n" + -// " Using 2 of 2 workers for concurrent marking\n" + -// "0.238: [Concurrent marking (process weakrefs) 32983K->34327K(36864K), 1.159 ms]\n" + -// "0.238: [Concurrent precleaning, start]\n" + -// " Using 1 of 2 workers for concurrent preclean\n" + -// "0.238: [Concurrent precleaning 34359K->34423K(36864K), 0.053 ms]\n" + -// "0.242: [Concurrent cleanup, start]\n" + -// "0.242: [Concurrent cleanup 34807K->34840K(36864K), 0.019 ms]\n" + -// "Free: 78M (56 regions), Max regular: 2048K, Max humongous: 61440K, External frag: 24%, Internal frag: 29%\n" + -// "Evacuation Reserve: 7M (4 regions), Max regular: 2048K\n" + -// "0.298: [Concurrent evacuation, start]\n" + -// " Using 2 of 2 workers for concurrent evacuation\n" + -// "0.299: [Concurrent evacuation 42458K->46621K(112M), 0.538 ms]\n" + -// "0.299: [Concurrent update references, start]\n" + -// " Using 2 of 2 workers for concurrent reference update\n" + -// "0.299: [Concurrent update references 46813K->49951K(112M), 0.481 ms]\n" + -// "Free: 118M (60 regions), Max regular: 2048K, Max humongous: 110592K, External frag: 9%, Internal frag: 1%\n" + -// "Evacuation Reserve: 8M (4 regions), Max regular: 2048K\n" + -// "Pacer for Idle. Initial: 2M, Alloc Tax Rate: 1.0x\n" + -// "1.115: [Concurrent uncommit, start]\n" + -// "1.129: [Concurrent uncommit 1986K->1986K(10240K), 13.524 ms]\n") -// .getBytes()); -// -// DataReader reader = new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_8); -// GCModel model = reader.read(); -// -// assertThat("gc count", model.size(), is(7)); -// assertThat("warnings", handler.getCount(), is(0)); -// -// AbstractGCEvent concurrentMarking = model.get(0); -// assertThat("Concurrent reset: name", concurrentMarking.getTypeAsString(), is("Concurrent reset")); -// assertThat("Concurrent reset: duration", concurrentMarking.getPause(), closeTo(0.000401, 0.0000001)); -// assertThat("Concurrent reset: before", concurrentMarking.getPreUsed(), is(32854)); -// assertThat("Concurrent reset: after", concurrentMarking.getPostUsed(), is(32983)); -// assertThat("Concurrent reset: total", concurrentMarking.getTotal(), is(34816)); -// } - @Test public void shenandoahIgnoredLines() throws Exception { TestLogHandler handler = new TestLogHandler(); @@ -394,46 +314,6 @@ public void shenandoahDetailsShutdown() throws Exception { is(1L)); } -// FIX ME! Only "Concurrent cleanup", "Concurrent uncommit", "Pause Degenerated GC", "Pause Full" event types have memory info -// @Test -// public void shenandoah_171_Beginning() throws Exception { -// // in its early implementation (jdk8u171), Shenandoah had memory information in the "Pause Final Mark" event, which was dropped later (jdk8u232) -// TestLogHandler handler = new TestLogHandler(); -// handler.setLevel(Level.INFO); -// GCResource gcResource = new GcResourceFile("SampleOpenJdk1_8_0-171-ShenandoahBeginning.txt"); -// gcResource.getLogger().addHandler(handler); -// -// DataReader reader = getDataReader(gcResource); -// GCModel model = reader.read(); -// -// assertThat("gc count", model.size(), is(3)); -// assertThat("number of errors", -// handler.getLogRecords().stream().filter(logRecord -> !logRecord.getLevel().equals(Level.INFO)).count(), -// is(2L)); -// assertThat("contains 'Initialize Shenandoah heap'", -// handler.getLogRecords().stream().filter(logRecord -> logRecord.getMessage().startsWith("Initialize Shenandoah heap")).count(), -// is(1L)); -// } -// -// @Test -// public void shenandoah_232_Beginning() throws Exception { -// TestLogHandler handler = new TestLogHandler(); -// handler.setLevel(Level.INFO); -// GCResource gcResource = new GcResourceFile("SampleOpenJdk1_8_0-232-ShenandoahBeginning.txt"); -// gcResource.getLogger().addHandler(handler); -// -// DataReader reader = getDataReader(gcResource); -// GCModel model = reader.read(); -// -// assertThat("gc count", model.size(), is(0)); -// assertThat("number of errors", -// handler.getLogRecords().stream().filter(logRecord -> !logRecord.getLevel().equals(Level.INFO)).count(), -// is(0L)); -// assertThat("contains 'Shenandoah heuristics'", -// handler.getLogRecords().stream().filter(logRecord -> logRecord.getMessage().startsWith("Shenandoah heuristics")).count(), -// is(1L)); -// } - @Test public void shenandoah_8u332() throws Exception { TestLogHandler handler = new TestLogHandler(); diff --git a/src/test/resources/openjdk/SampleOpenJdk1_8_0-171-ShenandoahBeginning.txt b/src/test/resources/openjdk/SampleOpenJdk1_8_0-171-ShenandoahBeginning.txt deleted file mode 100644 index 750427f5..00000000 --- a/src/test/resources/openjdk/SampleOpenJdk1_8_0-171-ShenandoahBeginning.txt +++ /dev/null @@ -1,38 +0,0 @@ -OpenJDK 64-Bit Server VM (25.171-b10) for linux-amd64 JRE (1.8.0_171-b10), built on May 16 2018 12:43:10 by "mockbuild" with gcc 4.8.5 20150623 (Red Hat 4.8.5-28) -Memory: 4k page, physical 528158808k(281795048k free), swap 2097148k(2097148k free) -CommandLine flags: -XX:GCLogFileSize=1048576 -XX:InitialHeapSize=274877906944 -XX:InitialTenuringThreshold=2 -XX:+LogVMOutput -XX:+ManagementServer -XX:MaxHeapSize=274877906944 -XX:MaxTenuringThreshold=2 -XX:NumberOfGCLogFiles=10 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UnlockDiagnosticVMOptions -XX:+UseGCLogFileRotation -XX:+UseNUMA -XX:+UseNUMAInterleaving -XX:+UseShenandoahGC -Heap region size: 32M -Region size in bytes: 33554432 -Region size byte shift: 25 -Humongous threshold in bytes: 33554432 -Number of regions: 8192 -Shenandoah heuristics: adaptive -Parallel GC threads: 33 -Concurrent GC threads: 33 -Parallel reference processing enabled: true -Initialize Shenandoah heap with initial size 274877906944 bytes -Concurrent marking triggered. Free: 78624M, Free Threshold: 78643M; Allocated: 78624M, Alloc Threshold: 0M -25.465: [Pause Init Mark, 43.460 ms] -25.508: [Concurrent marking 178G->184G(256G), 3685.818 ms] -29.197: [Pause Final MarkTotal Garbage: 44620M -Immediate Garbage: 3296M, 103 regions (20% of total) -Garbage to be collected: 12532M (28% of total), 396 regions -Live objects to be evacuated: 139M -Live/garbage ratio in collected regions: 1% - 184G->181G(256G), 4.730 ms] -29.202: [Concurrent evacuation 181G->182G(256G), 19.154 ms] -29.222: [Pause Init Update Refs, 0.314 ms] -29.222: [Concurrent update references 182G->184G(256G), 2188.225 ms] -31.417: [Pause Final Update Refs 184G->172G(256G), 3.659 ms] -31.420: [Concurrent reset bitmaps 172G->172G(256G), 1.735 ms] -Capacity: 262144M, Peak Occupancy: 188928M, Lowest Free: 73215M, Free Threshold: 7864M -Concurrent marking triggered. Free: 78624M, Free Threshold: 78643M; Allocated: 78624M, Alloc Threshold: 0M -53.071: [Concurrent reset bitmaps 190G->190G(256G), 99.589 ms] -Capacity: 262144M, Peak Occupancy: 196064M, Lowest Free: 66079M, Free Threshold: 7864M -Adjusting free threshold to: 25% (65536M) -Concurrent marking triggered. Free: 65504M, Free Threshold: 65536M; Allocated: 65504M, Alloc Threshold: 0M -58.663: [Concurrent reset bitmaps 194G->194G(256G), 105.318 ms] -Capacity: 262144M, Peak Occupancy: 199040M, Lowest Free: 63103M, Free Threshold: 7864M -Concurrent marking triggered. Free: 63360M, Free Threshold: 170393M; Allocated: 63360M, Alloc Threshold: 0M -Predicted cset threshold: 40, 1114112K CSet (0%) -58.770: [Pause Init Mark, 8.571 ms] diff --git a/src/test/resources/openjdk/SampleOpenJdk1_8_0-232-ShenandoahBeginning.txt b/src/test/resources/openjdk/SampleOpenJdk1_8_0-232-ShenandoahBeginning.txt deleted file mode 100644 index 26025341..00000000 --- a/src/test/resources/openjdk/SampleOpenJdk1_8_0-232-ShenandoahBeginning.txt +++ /dev/null @@ -1,27 +0,0 @@ -OpenJDK 64-Bit Server VM (25.71-b433-20190907-aarch64-shenandoah-jdk8u232-05) for linux-amd64 JRE (1.8.0-builds.shipilev.net-openjdk-shenandoah-jdk8-b433-20190907-aarch64-shenandoah-jdk8u232-b05), built on Sep 7 2019 03:47:42 by "buildbot" with gcc 6.3.0 20170516 -Memory: 4k page, physical 2047012k(883308k free), swap 1048572k(1048572k free) -CommandLine flags: -XX:InitialHeapSize=32752192 -XX:MaxHeapSize=134217728 -XX:+PrintGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+UnlockDiagnosticVMOptions -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseShenandoahGC -XX:+UseTransparentHugePages -Regions: 64 x 2048K -Humongous object threshold: 2048K -Max TLAB size: 256K -GC threads: 2 parallel, 2 concurrent -Reference processing: parallel -Heuristics ergonomically sets -XX:+ExplicitGCInvokesConcurrent -Heuristics ergonomically sets -XX:+ShenandoahImplicitGCInvokesConcurrent -Shenandoah heuristics: adaptive -Pacer for Idle. Initial: 2M, Alloc Tax Rate: 1.0x -Initialize Shenandoah heap: 32768K initial, 8192K min, 128M max -Trigger: Learning 1 of 5. Free (87M) is below initial threshold (89M) -Free: 87M (44 regions), Max regular: 2048K, Max humongous: 88064K, External frag: 2%, Internal frag: 0% -Evacuation Reserve: 8M (4 regions), Max regular: 2048K -0.233: [Concurrent reset, start] - Using 2 of 2 workers for concurrent reset -0.234: [Concurrent reset 32854K->32983K(34816K), 0.401 ms] -0.234: [Pause Init Mark (process weakrefs), start] - Using 2 of 2 workers for init marking - Pacer for Mark. Expected Live: 12M, Free: 87M, Non-Taxable: 8M, Alloc Tax Rate: 0.5x -0.239: [Pause Final Mark (process weakrefs), start] - Using 2 of 2 workers for final marking - Adaptive CSet Selection. Target Free: 12M, Actual Free: 92M, Max CSet: 5M, Min Garbage: 0M - Collectable Garbage: 0M (0% of total), 0M CSet, 0 CSet regions - Immediate Garbage: 0M (0% of total), 0 regions