From 68e719616707803761ee3f2c938fe081869db0c5 Mon Sep 17 00:00:00 2001 From: Mike Millson Date: Thu, 20 Apr 2017 10:02:46 -0400 Subject: [PATCH] Additional parallelism improvements. --- .../java/org/eclipselabs/garbagecat/Main.java | 9 +-- .../eclipselabs/garbagecat/domain/JvmRun.java | 37 ++++++++---- .../eclipselabs/garbagecat/hsql/JvmDao.java | 56 +++++++++++++------ .../garbagecat/service/GcManager.java | 22 ++++---- .../garbagecat/domain/TestJvmRun.java | 4 +- .../jdk/TestG1PreprocessAction.java | 2 +- .../garbagecat/util/jdk/TestAnalysis.java | 2 +- 7 files changed, 84 insertions(+), 48 deletions(-) diff --git a/src/main/java/org/eclipselabs/garbagecat/Main.java b/src/main/java/org/eclipselabs/garbagecat/Main.java index 638641ed..590d9b76 100644 --- a/src/main/java/org/eclipselabs/garbagecat/Main.java +++ b/src/main/java/org/eclipselabs/garbagecat/Main.java @@ -394,13 +394,14 @@ public static void createReport(JvmRun jvmRun, String reportFileName) { bufferedWriter.write("========================================" + System.getProperty("line.separator")); // Parallelism - if (jvmRun.getBadParallelismCount() > 0) { + if (jvmRun.getLowParallelismCount() > 0) { // Parallelism - bufferedWriter.write("LOW PARALLELISM:" + System.getProperty("line.separator")); + bufferedWriter.write("PARALLELISM:" + System.getProperty("line.separator")); bufferedWriter.write("----------------------------------------" + System.getProperty("line.separator")); + bufferedWriter.write("# Events: " + jvmRun.getParallelCount() + System.getProperty("line.separator")); bufferedWriter - .write("# Events: " + jvmRun.getBadParallelismCount() + System.getProperty("line.separator")); - bufferedWriter.write("Worst Event: " + jvmRun.getBaddestParallelismEvent().getLogEntry() + .write("# Low: " + jvmRun.getLowParallelismCount() + System.getProperty("line.separator")); + bufferedWriter.write("Worst Low Event: " + jvmRun.getWorstLowParallelismEvent().getLogEntry() + System.getProperty("line.separator")); bufferedWriter.write("========================================" + System.getProperty("line.separator")); } diff --git a/src/main/java/org/eclipselabs/garbagecat/domain/JvmRun.java b/src/main/java/org/eclipselabs/garbagecat/domain/JvmRun.java index 35b6b75d..9b78cec1 100644 --- a/src/main/java/org/eclipselabs/garbagecat/domain/JvmRun.java +++ b/src/main/java/org/eclipselabs/garbagecat/domain/JvmRun.java @@ -161,14 +161,19 @@ public class JvmRun { private String lastLogLineUnprocessed; /** - * The ParallelCollection event with the worst "bad" parallelism (0-1). + * Number of ParallelCollection events. */ - private LogEvent baddestParallelismEvent; + private long parallelCount; /** - * The number of ParallelCollection with "bad" parallelism (0-1). + * Number of ParallelCollection with "low" parallelism. */ - private long badParallelismCount; + private long lowParallelismCount; + + /** + * ParallelCollection event with the lowest "low" parallelism. + */ + private LogEvent worstLowParallelismEvent; /** * Constructor accepting throughput threshold, JVM services, and JVM environment information. @@ -379,20 +384,28 @@ public void setLastLogLineUnprocessed(String lastLogLineUnprocessed) { this.lastLogLineUnprocessed = lastLogLineUnprocessed; } - public LogEvent getBaddestParallelismEvent() { - return baddestParallelismEvent; + public long getParallelCount() { + return parallelCount; + } + + public void setParallelCount(long parallelCount) { + this.parallelCount = parallelCount; + } + + public long getLowParallelismCount() { + return lowParallelismCount; } - public void setBaddestParallelismEvent(LogEvent baddestParallelismEvent) { - this.baddestParallelismEvent = baddestParallelismEvent; + public void setLowParallelismCount(long lowParallelismCount) { + this.lowParallelismCount = lowParallelismCount; } - public long getBadParallelismCount() { - return badParallelismCount; + public LogEvent getWorstLowParallelismEvent() { + return worstLowParallelismEvent; } - public void setBadParallelismCount(long badParallelismCount) { - this.badParallelismCount = badParallelismCount; + public void setWorstLowParallelismEvent(LogEvent worstLowParallelismEvent) { + this.worstLowParallelismEvent = worstLowParallelismEvent; } /** diff --git a/src/main/java/org/eclipselabs/garbagecat/hsql/JvmDao.java b/src/main/java/org/eclipselabs/garbagecat/hsql/JvmDao.java index 284364db..6481e9b9 100644 --- a/src/main/java/org/eclipselabs/garbagecat/hsql/JvmDao.java +++ b/src/main/java/org/eclipselabs/garbagecat/hsql/JvmDao.java @@ -144,14 +144,19 @@ public class JvmDao { private long swapFree; /** - * The ParallelCollection event with the worst "bad" parallelism (0-1). + * Number of ParallelCollection events. */ - private LogEvent baddestParallelismEvent; + private long parallelCount; /** - * The number of ParallelCollection with "bad" parallelism (0-1). + * Number of ParallelCollection with "low" parallelism. */ - private long badParallelismCount; + private long lowParallelismCount; + + /** + * ParallelCollection event with the lowest "low" parallelism. + */ + private LogEvent worstLowParallelismEvent; public JvmDao() { try { @@ -349,33 +354,48 @@ public void setSwapFree(long swapFree) { } /** - * @return The worst "bad" (0-1) parallelism event. + * @return The number of ParallelCollection events. + */ + public long getParallelCount() { + return parallelCount; + } + + /** + * @param parallelCount + * The number of ParallelCollection events. + */ + public void setParallelCount(long parallelCount) { + this.parallelCount = parallelCount; + } + + /** + * @return The number of "low" parallelism events. */ - public LogEvent getBaddestParallelismEvent() { - return baddestParallelismEvent; + public long getLowParallelismCount() { + return lowParallelismCount; } /** - * @param baddestParallelismEvent - * The ParallelCollection with the worst "bad" (0-1) parallelism. + * @param lowParallelismCount + * The number of "low" parallelism events. */ - public void setBaddestParallelismEvent(LogEvent baddestParallelismEvent) { - this.baddestParallelismEvent = baddestParallelismEvent; + public void setLowParallelismCount(long lowParallelismCount) { + this.lowParallelismCount = lowParallelismCount; } /** - * @return The number of "bad" (0-1) parallelism events. + * @return The ParallelCollection event with the lowest "low" parallelism. */ - public long getBadParallelismCount() { - return badParallelismCount; + public LogEvent getWorstLowParallelismEvent() { + return worstLowParallelismEvent; } /** - * @param badParallelismCount - * The number of "bad" (0-1) parallelism events. + * @param worstLowParallelismEvent + * The ParallelCollection event with the lowest "low" parallelism. */ - public void setBadParallelismCount(long badParallelismCount) { - this.badParallelismCount = badParallelismCount; + public void setWorstLowParallelismEvent(LogEvent worstLowParallelismEvent) { + this.worstLowParallelismEvent = worstLowParallelismEvent; } /** diff --git a/src/main/java/org/eclipselabs/garbagecat/service/GcManager.java b/src/main/java/org/eclipselabs/garbagecat/service/GcManager.java index 33258479..7ea60736 100644 --- a/src/main/java/org/eclipselabs/garbagecat/service/GcManager.java +++ b/src/main/java/org/eclipselabs/garbagecat/service/GcManager.java @@ -605,19 +605,20 @@ public void store(File logFile, boolean reorder) { } } - // 16) Bad parallelism (0-1) + // 16) Low parallelism (> 0, <= 1) if (event instanceof ParallelCollection && event instanceof TimesData) { + jvmDao.setParallelCount(jvmDao.getParallelCount() + 1); if (((TimesData) event).getParallelism() > 0 && ((TimesData) event).getParallelism() <= 1) { - // bad parallelism - jvmDao.setBadParallelismCount(jvmDao.getBadParallelismCount() + 1); - if (jvmDao.getBaddestParallelismEvent() == null) { - jvmDao.setBaddestParallelismEvent(event); + // low parallelism + jvmDao.setLowParallelismCount(jvmDao.getLowParallelismCount() + 1); + if (jvmDao.getWorstLowParallelismEvent() == null) { + jvmDao.setWorstLowParallelismEvent(event); } else { if (((TimesData) event) - .getParallelism() < ((TimesData) jvmDao.getBaddestParallelismEvent()) + .getParallelism() < ((TimesData) jvmDao.getWorstLowParallelismEvent()) .getParallelism()) { - // Update baddest - jvmDao.setBaddestParallelismEvent(event); + // Update lowest "low" + jvmDao.setWorstLowParallelismEvent(event); } } } @@ -821,8 +822,9 @@ public JvmRun getJvmRun(Jvm jvm, int throughputThreshold) { jvmRun.setCollectorFamiles(jvmDao.getCollectorFamilies()); jvmRun.setAnalysis(jvmDao.getAnalysis()); jvmRun.setBottlenecks(getBottlenecks(jvm, throughputThreshold)); - jvmRun.setBaddestParallelismEvent(jvmDao.getBaddestParallelismEvent()); - jvmRun.setBadParallelismCount(jvmDao.getBadParallelismCount()); + jvmRun.setParallelCount(jvmDao.getParallelCount()); + jvmRun.setLowParallelismCount(jvmDao.getLowParallelismCount()); + jvmRun.setWorstLowParallelismEvent(jvmDao.getWorstLowParallelismEvent()); jvmRun.doAnalysis(); return jvmRun; } diff --git a/src/test/java/org/eclipselabs/garbagecat/domain/TestJvmRun.java b/src/test/java/org/eclipselabs/garbagecat/domain/TestJvmRun.java index 9c2d5676..32b15387 100644 --- a/src/test/java/org/eclipselabs/garbagecat/domain/TestJvmRun.java +++ b/src/test/java/org/eclipselabs/garbagecat/domain/TestJvmRun.java @@ -469,7 +469,7 @@ public void testApplicationStoppedTimeNoTimestamps() { Assert.assertEquals("JVM run duration not correct.", 31703, jvmRun.getJvmRunDuration()); Assert.assertEquals("GC throughput not correct.", 93, jvmRun.getGcThroughput()); Assert.assertEquals("Stopped time throughput not correct.", 94, jvmRun.getStoppedTimeThroughput()); - Assert.assertEquals("Bad parallelism event count not correct.", 1, jvmRun.getBadParallelismCount()); + Assert.assertEquals("Bad parallelism event count not correct.", 1, jvmRun.getLowParallelismCount()); } /** @@ -535,7 +535,7 @@ public void testStopedTime() { Assert.assertEquals("Stopped time throughput not correct.", 4, jvmRun.getStoppedTimeThroughput()); Assert.assertFalse(Analysis.WARN_GC_STOPPED_RATIO + " analysis incorrectly identified.", jvmRun.getAnalysis().contains(Analysis.WARN_GC_STOPPED_RATIO)); - Assert.assertEquals("Bad parallelism event count not correct.", 12, jvmRun.getBadParallelismCount()); + Assert.assertEquals("Bad parallelism event count not correct.", 12, jvmRun.getLowParallelismCount()); } /** diff --git a/src/test/java/org/eclipselabs/garbagecat/preprocess/jdk/TestG1PreprocessAction.java b/src/test/java/org/eclipselabs/garbagecat/preprocess/jdk/TestG1PreprocessAction.java index 9015ffb2..d5e58116 100644 --- a/src/test/java/org/eclipselabs/garbagecat/preprocess/jdk/TestG1PreprocessAction.java +++ b/src/test/java/org/eclipselabs/garbagecat/preprocess/jdk/TestG1PreprocessAction.java @@ -904,7 +904,7 @@ public void testG1PreprocessActionG1YoungPauseLogging() { Assert.assertEquals("Event type count not correct.", 1, jvmRun.getEventTypes().size()); Assert.assertTrue("Log line not recognized as " + JdkUtil.LogEventType.G1_YOUNG_PAUSE.toString() + ".", jvmRun.getEventTypes().contains(JdkUtil.LogEventType.G1_YOUNG_PAUSE)); - Assert.assertEquals("Bad parallelism event count not correct.", 1, jvmRun.getBadParallelismCount()); + Assert.assertEquals("Bad parallelism event count not correct.", 1, jvmRun.getLowParallelismCount()); } /** diff --git a/src/test/java/org/eclipselabs/garbagecat/util/jdk/TestAnalysis.java b/src/test/java/org/eclipselabs/garbagecat/util/jdk/TestAnalysis.java index 082cd328..81c39b42 100644 --- a/src/test/java/org/eclipselabs/garbagecat/util/jdk/TestAnalysis.java +++ b/src/test/java/org/eclipselabs/garbagecat/util/jdk/TestAnalysis.java @@ -894,7 +894,7 @@ public void testParallelOldCompactingExplicitGc() { jvmRun.getAnalysis().contains(Analysis.WARN_EXPLICIT_GC_PARALLEL)); Assert.assertFalse(Analysis.ERROR_SERIAL_GC_PARALLEL + " analysis incorrectly identified.", jvmRun.getAnalysis().contains(Analysis.ERROR_SERIAL_GC_PARALLEL)); - Assert.assertEquals("Bad parallelism event count not correct.", 2, jvmRun.getBadParallelismCount()); + Assert.assertEquals("Bad parallelism event count not correct.", 2, jvmRun.getLowParallelismCount()); } public void testThreadStackSizeAnalysis32Bit() {