Skip to content

Commit fe602b4

Browse files
committed
cleanup tests following suggestions of cuiweilong
1 parent e76f8a7 commit fe602b4

File tree

6 files changed

+7
-190
lines changed

6 files changed

+7
-190
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ GCViewer 1.36
33

44
[![Build Status](https://app.travis-ci.com/chewiebug/GCViewer.svg?branch=develop)](https://app.travis-ci.com/chewiebug/GCViewer)
55
[![codecov.io](https://codecov.io/github/chewiebug/GCViewer/coverage.svg?branch=develop)](https://codecov.io/github/chewiebug/GCViewer?branch=develop)
6-
[![Download gcviewer](https://img.shields.io/sourceforge/dm/gcviewer.svg)](https://sourceforge.net/projects/gcviewer/files/latest/download)
6+
[![Download gcviewer](https://img.shields.io/sourceforge/dm/gcviewer.svg)](https://sourceforge.net/projects/gcviewer/files)
77

88
GCViewer is a little tool that visualizes verbose GC output
99
generated by Sun / Oracle, IBM, HP and BEA Java Virtual Machines. It

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import javax.xml.stream.events.XMLEvent;
2121

2222
import com.tagtraum.perf.gcviewer.model.AbstractGCEvent;
23+
import com.tagtraum.perf.gcviewer.model.AbstractGCEvent.ExtendedType;
2324
import com.tagtraum.perf.gcviewer.model.AbstractGCEvent.Type;
2425
import com.tagtraum.perf.gcviewer.model.GCEvent;
2526
import com.tagtraum.perf.gcviewer.model.GCModel;
@@ -92,7 +93,7 @@ public GCModel read() throws IOException {
9293
break;
9394
case EXCLUSIVE_END:
9495
handleExclusiveEnd(startElement, currentGcEvent);
95-
if (currentGcEvent.getExtendedType() == null) {
96+
if (currentGcEvent.getExtendedType() == null || currentGcEvent.getExtendedType() == ExtendedType.UNDEFINED) {
9697
if (getLogger().isLoggable(Level.FINE))
9798
getLogger().fine("event at " + in.getLineNumber() + " doesn't contain any information, the parser can handle");
9899
}

src/main/java/com/tagtraum/perf/gcviewer/model/AbstractGCEvent.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ public static class ExtendedType implements Serializable {
368368
static {
369369
WRAPPER_MAP.put(Type.UNDEFINED.getName(), new ExtendedType(Type.UNDEFINED));
370370
}
371-
public static final ExtendedType UNDEFINED = WRAPPER_MAP.get(Type.UNDEFINED);
371+
public static final ExtendedType UNDEFINED = WRAPPER_MAP.get(Type.UNDEFINED.getName());
372372

373373
private String fullName;
374374
private Type type;
@@ -683,7 +683,8 @@ public String toString() {
683683
public static final Type UJL_G1_PHASE_COMPACT_HEAP = new Type("Phase 4: Compact heap", Generation.YOUNG, Concurrency.SERIAL, GcPattern.GC_PAUSE);
684684

685685
// unified jvm logging shenandoah event types
686-
// Only "Concurrent cleanup", "Concurrent uncommit", "Pause Degenerated GC", "Pause Full" event types have memory info
686+
// shenandoah in the earlier jdk1.8 versions had more events with GC_MEMORY_PAUSE patterns. Those versions are not supported any more, breaking
687+
// backwards compatibility of the parser. If that backwards compatibility should be needed, more flexibility will have to be built into it.
687688
public static final Type UJL_SHEN_PAUSE_INIT_MARK = new Type("Pause Init Mark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
688689
public static final Type UJL_SHEN_PAUSE_FINAL_MARK = new Type("Pause Final Mark", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);
689690
public static final Type UJL_SHEN_PAUSE_INIT_UPDATE_REFS = new Type("Pause Init Update Refs", Generation.TENURED, Concurrency.SERIAL, GcPattern.GC_PAUSE);

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

Lines changed: 1 addition & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
import com.tagtraum.perf.gcviewer.UnittestHelper.FOLDER;
1717
import com.tagtraum.perf.gcviewer.model.AbstractGCEvent;
1818
import com.tagtraum.perf.gcviewer.model.AbstractGCEvent.Type;
19-
import com.tagtraum.perf.gcviewer.util.DateHelper;
2019
import com.tagtraum.perf.gcviewer.model.GCModel;
2120
import com.tagtraum.perf.gcviewer.model.GCResource;
2221
import com.tagtraum.perf.gcviewer.model.GcResourceFile;
22+
import com.tagtraum.perf.gcviewer.util.DateHelper;
2323
import org.junit.Test;
2424

2525
/**
@@ -221,86 +221,6 @@ public void shenandoahPauseUpdateRefs() throws Exception {
221221
assertThat("Pause Final Update Refs: duration", finalUpdateRefsEvent.getPause(), closeTo(0.000291, 0.00001));
222222
}
223223

224-
// FIX ME! Only "Concurrent cleanup", "Concurrent uncommit", "Pause Degenerated GC", "Pause Full" event types have memory info
225-
// @Test
226-
// public void shehandoahConcurrentEventsjsk8u171() throws Exception {
227-
// // FIX ME! I think the test is overtime and need removed, alert the log string for build success.
228-
// // probably jdk8u171
229-
// TestLogHandler handler = new TestLogHandler();
230-
// handler.setLevel(Level.WARNING);
231-
// GCResource gcResource = new GcResourceFile("byteArray");
232-
// gcResource.getLogger().addHandler(handler);
233-
//
234-
// ByteArrayInputStream in = new ByteArrayInputStream(
235-
// ("13.979: [Concurrent marking 1435M->1447M(2048M), 12.576 ms]" +
236-
// "\n13.994: [Concurrent evacuation 684M->712M(2048M), 6.041 ms]" +
237-
// "\n14.001: [Concurrent update references 713M->726M(2048M), 14.718 ms]" +
238-
// "\n14.017: [Concurrent reset bitmaps 60M->62M(2048M), 0.294 ms]" +
239-
// "\n626.259: [Cancel concurrent mark, 0.056 ms]\n")
240-
// .getBytes());
241-
//
242-
// DataReader reader = new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_8);
243-
// GCModel model = reader.read();
244-
//
245-
// assertThat("gc count", model.size(), is(5));
246-
// assertThat("warnings", handler.getCount(), is(0));
247-
//
248-
// AbstractGCEvent<?> concurrentMarking = model.get(0);
249-
// assertThat("Concurrent Marking: name", concurrentMarking.getTypeAsString(), equalTo("Concurrent marking"));
250-
// assertThat("Concurrent Marking: duration", concurrentMarking.getPause(), closeTo(0.012576, 0.0000001));
251-
// assertThat("Concurrent Marking: before", concurrentMarking.getPreUsed(), is(1435 * 1024));
252-
// assertThat("Concurrent Marking: after", concurrentMarking.getPostUsed(), is(1447 * 1024));
253-
// assertThat("Concurrent Marking: total", concurrentMarking.getTotal(), is(2048 * 1024));
254-
// }
255-
//
256-
// @Test
257-
// public void shehandoahConcurrentEventsjsk8u232() throws Exception {
258-
// TestLogHandler handler = new TestLogHandler();
259-
// handler.setLevel(Level.WARNING);
260-
// GCResource gcResource = new GcResourceFile("byteArray");
261-
// gcResource.getLogger().addHandler(handler);
262-
//
263-
// ByteArrayInputStream in = new ByteArrayInputStream(
264-
// ("0.233: [Concurrent reset, start]\n" +
265-
// " Using 2 of 2 workers for concurrent reset\n" +
266-
// "0.234: [Concurrent reset 32854K->32983K(34816K), 0.401 ms]\n" +
267-
// "0.237: [Concurrent marking (process weakrefs), start]\n" +
268-
// " Using 2 of 2 workers for concurrent marking\n" +
269-
// "0.238: [Concurrent marking (process weakrefs) 32983K->34327K(36864K), 1.159 ms]\n" +
270-
// "0.238: [Concurrent precleaning, start]\n" +
271-
// " Using 1 of 2 workers for concurrent preclean\n" +
272-
// "0.238: [Concurrent precleaning 34359K->34423K(36864K), 0.053 ms]\n" +
273-
// "0.242: [Concurrent cleanup, start]\n" +
274-
// "0.242: [Concurrent cleanup 34807K->34840K(36864K), 0.019 ms]\n" +
275-
// "Free: 78M (56 regions), Max regular: 2048K, Max humongous: 61440K, External frag: 24%, Internal frag: 29%\n" +
276-
// "Evacuation Reserve: 7M (4 regions), Max regular: 2048K\n" +
277-
// "0.298: [Concurrent evacuation, start]\n" +
278-
// " Using 2 of 2 workers for concurrent evacuation\n" +
279-
// "0.299: [Concurrent evacuation 42458K->46621K(112M), 0.538 ms]\n" +
280-
// "0.299: [Concurrent update references, start]\n" +
281-
// " Using 2 of 2 workers for concurrent reference update\n" +
282-
// "0.299: [Concurrent update references 46813K->49951K(112M), 0.481 ms]\n" +
283-
// "Free: 118M (60 regions), Max regular: 2048K, Max humongous: 110592K, External frag: 9%, Internal frag: 1%\n" +
284-
// "Evacuation Reserve: 8M (4 regions), Max regular: 2048K\n" +
285-
// "Pacer for Idle. Initial: 2M, Alloc Tax Rate: 1.0x\n" +
286-
// "1.115: [Concurrent uncommit, start]\n" +
287-
// "1.129: [Concurrent uncommit 1986K->1986K(10240K), 13.524 ms]\n")
288-
// .getBytes());
289-
//
290-
// DataReader reader = new DataReaderSun1_6_0(gcResource, in, GcLogType.SUN1_8);
291-
// GCModel model = reader.read();
292-
//
293-
// assertThat("gc count", model.size(), is(7));
294-
// assertThat("warnings", handler.getCount(), is(0));
295-
//
296-
// AbstractGCEvent<?> concurrentMarking = model.get(0);
297-
// assertThat("Concurrent reset: name", concurrentMarking.getTypeAsString(), is("Concurrent reset"));
298-
// assertThat("Concurrent reset: duration", concurrentMarking.getPause(), closeTo(0.000401, 0.0000001));
299-
// assertThat("Concurrent reset: before", concurrentMarking.getPreUsed(), is(32854));
300-
// assertThat("Concurrent reset: after", concurrentMarking.getPostUsed(), is(32983));
301-
// assertThat("Concurrent reset: total", concurrentMarking.getTotal(), is(34816));
302-
// }
303-
304224
@Test
305225
public void shenandoahIgnoredLines() throws Exception {
306226
TestLogHandler handler = new TestLogHandler();
@@ -394,46 +314,6 @@ public void shenandoahDetailsShutdown() throws Exception {
394314
is(1L));
395315
}
396316

397-
// FIX ME! Only "Concurrent cleanup", "Concurrent uncommit", "Pause Degenerated GC", "Pause Full" event types have memory info
398-
// @Test
399-
// public void shenandoah_171_Beginning() throws Exception {
400-
// // in its early implementation (jdk8u171), Shenandoah had memory information in the "Pause Final Mark" event, which was dropped later (jdk8u232)
401-
// TestLogHandler handler = new TestLogHandler();
402-
// handler.setLevel(Level.INFO);
403-
// GCResource gcResource = new GcResourceFile("SampleOpenJdk1_8_0-171-ShenandoahBeginning.txt");
404-
// gcResource.getLogger().addHandler(handler);
405-
//
406-
// DataReader reader = getDataReader(gcResource);
407-
// GCModel model = reader.read();
408-
//
409-
// assertThat("gc count", model.size(), is(3));
410-
// assertThat("number of errors",
411-
// handler.getLogRecords().stream().filter(logRecord -> !logRecord.getLevel().equals(Level.INFO)).count(),
412-
// is(2L));
413-
// assertThat("contains 'Initialize Shenandoah heap'",
414-
// handler.getLogRecords().stream().filter(logRecord -> logRecord.getMessage().startsWith("Initialize Shenandoah heap")).count(),
415-
// is(1L));
416-
// }
417-
//
418-
// @Test
419-
// public void shenandoah_232_Beginning() throws Exception {
420-
// TestLogHandler handler = new TestLogHandler();
421-
// handler.setLevel(Level.INFO);
422-
// GCResource gcResource = new GcResourceFile("SampleOpenJdk1_8_0-232-ShenandoahBeginning.txt");
423-
// gcResource.getLogger().addHandler(handler);
424-
//
425-
// DataReader reader = getDataReader(gcResource);
426-
// GCModel model = reader.read();
427-
//
428-
// assertThat("gc count", model.size(), is(0));
429-
// assertThat("number of errors",
430-
// handler.getLogRecords().stream().filter(logRecord -> !logRecord.getLevel().equals(Level.INFO)).count(),
431-
// is(0L));
432-
// assertThat("contains 'Shenandoah heuristics'",
433-
// handler.getLogRecords().stream().filter(logRecord -> logRecord.getMessage().startsWith("Shenandoah heuristics")).count(),
434-
// is(1L));
435-
// }
436-
437317
@Test
438318
public void shenandoah_8u332() throws Exception {
439319
TestLogHandler handler = new TestLogHandler();

src/test/resources/openjdk/SampleOpenJdk1_8_0-171-ShenandoahBeginning.txt

Lines changed: 0 additions & 38 deletions
This file was deleted.

src/test/resources/openjdk/SampleOpenJdk1_8_0-232-ShenandoahBeginning.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)