Skip to content

Commit

Permalink
Additional parallelism improvements.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Millson committed Apr 20, 2017
1 parent 6312eda commit 68e7196
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 48 deletions.
9 changes: 5 additions & 4 deletions src/main/java/org/eclipselabs/garbagecat/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
Expand Down
37 changes: 25 additions & 12 deletions src/main/java/org/eclipselabs/garbagecat/domain/JvmRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,19 @@ public class JvmRun {
private String lastLogLineUnprocessed;

/**
* The <code>ParallelCollection</code> event with the worst "bad" parallelism (0-1).
* Number of <code>ParallelCollection</code> events.
*/
private LogEvent baddestParallelismEvent;
private long parallelCount;

/**
* The number of <code>ParallelCollection</code> with "bad" parallelism (0-1).
* Number of <code>ParallelCollection</code> with "low" parallelism.
*/
private long badParallelismCount;
private long lowParallelismCount;

/**
* <code>ParallelCollection</code> event with the lowest "low" parallelism.
*/
private LogEvent worstLowParallelismEvent;

/**
* Constructor accepting throughput threshold, JVM services, and JVM environment information.
Expand Down Expand Up @@ -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;
}

/**
Expand Down
56 changes: 38 additions & 18 deletions src/main/java/org/eclipselabs/garbagecat/hsql/JvmDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,19 @@ public class JvmDao {
private long swapFree;

/**
* The <code>ParallelCollection</code> event with the worst "bad" parallelism (0-1).
* Number of <code>ParallelCollection</code> events.
*/
private LogEvent baddestParallelismEvent;
private long parallelCount;

/**
* The number of <code>ParallelCollection</code> with "bad" parallelism (0-1).
* Number of <code>ParallelCollection</code> with "low" parallelism.
*/
private long badParallelismCount;
private long lowParallelismCount;

/**
* <code>ParallelCollection</code> event with the lowest "low" parallelism.
*/
private LogEvent worstLowParallelismEvent;

public JvmDao() {
try {
Expand Down Expand Up @@ -349,33 +354,48 @@ public void setSwapFree(long swapFree) {
}

/**
* @return The worst "bad" (0-1) parallelism event.
* @return The number of <code>ParallelCollection</code> events.
*/
public long getParallelCount() {
return parallelCount;
}

/**
* @param parallelCount
* The number of <code>ParallelCollection</code> 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 <code>ParallelCollection</code> 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 <code>ParallelCollection</code> 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 <code>ParallelCollection</code> event with the lowest "low" parallelism.
*/
public void setBadParallelismCount(long badParallelismCount) {
this.badParallelismCount = badParallelismCount;
public void setWorstLowParallelismEvent(LogEvent worstLowParallelismEvent) {
this.worstLowParallelismEvent = worstLowParallelismEvent;
}

/**
Expand Down
22 changes: 12 additions & 10 deletions src/main/java/org/eclipselabs/garbagecat/service/GcManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down Expand Up @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 68e7196

Please sign in to comment.