Skip to content

Commit

Permalink
[JBTM-1453] Increase number of runs
Browse files Browse the repository at this point in the history
  • Loading branch information
mmusgrov committed Jul 1, 2014
1 parent 914fade commit 30cb74c
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ public void run() {
long timeInMillis = (endTime - startTime) + additionalCleanuptime;
long throughput = Math.round((totalExecuted.intValue() / (timeInMillis / 1000d)));

System.out.println(" Total transactions: " + totalExecuted.intValue());
System.out.println(" Total time millis: " + timeInMillis);
System.out.println(" Average transaction time: " + timeInMillis
/ totalExecuted.intValue());
Expand All @@ -490,7 +491,7 @@ public void run() {

boolean correct = PerformanceProfileStore.checkPerformance(getClass().getName() + testName, throughput, true);

Assert.assertTrue("performance regression", correct);
Assert.assertTrue(getClass().getName() + testName + ": performance regression", correct);
}

private class Handler {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public boolean updateMetric(String metricName, Float metricValue, boolean larger
": Performance profile (time in milli-seconds)");
}

return isWithinTolerance(metricValue, canonicalValue, variance, largerIsBetter);
return isWithinTolerance(metricName, metricValue, canonicalValue, variance, largerIsBetter);
}

public static PerformanceProfileStore getMetrics() throws IOException {
Expand All @@ -129,7 +129,7 @@ public static boolean checkPerformance(String performanceName, float operationDu
}
}

boolean isWithinTolerance(Float metricValue, Float canonicalValue, Float variance, boolean largerIsBetter) {
boolean isWithinTolerance(String metricName, Float metricValue, Float canonicalValue, Float variance, boolean largerIsBetter) {
Float headRoom = Math.abs(canonicalValue * (variance - 1));

boolean within;
Expand All @@ -139,8 +139,8 @@ boolean isWithinTolerance(Float metricValue, Float canonicalValue, Float varianc
else
within = (metricValue <= canonicalValue + headRoom);

System.out.printf("actual %f versus best %f: variance %f: head room: %f biggerBetter=%b ok=%b%n",
metricValue, canonicalValue, variance, headRoom, largerIsBetter, within);
System.out.printf("%s: actual %f versus best %f: variance %f: head room: %f biggerBetter=%b ok=%b%n",
metricName, metricValue, canonicalValue, variance, headRoom, largerIsBetter, within);

return within;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,28 @@ public static void beforeClass() throws Exception {
// 2PC commit
@Test
public void measureThroughput() throws Exception {
int callCount = Integer.getInteger("callCount", 1000);
int threadCount = Integer.getInteger("threadCount", 10);
int batchSize = Integer.getInteger("batchSize", 50);
boolean failOnRegression = PerformanceProfileStore.isFailOnRegression();
int defaultCallCount = failOnRegression ? 150000 : 1000;
int defaultThreadCount = failOnRegression ? 50 : 10;
int defaultBatchSize = failOnRegression ? 100 : 50;

int callCount = Integer.getInteger("callCount", defaultCallCount);
int threadCount = Integer.getInteger("threadCount", defaultThreadCount);
int batchSize = Integer.getInteger("batchSize", defaultBatchSize);

Result<String> opts = new Result<String>(threadCount, callCount, batchSize).measure(new RTSWorker());

String info = USE_SPDY ? "SPDY" : USE_SSL ? "SSL" : USE_UNDERTOW ? "UTOW" : "none";
String metricName = getClass().getName() + "_measureThroughput_" + info;

System.out.printf("%s: Test performance: %d calls/sec (%d invocations using %d threads with %d errors. Total time %d ms)%n",
info, opts.getThroughput(), opts.getNumberOfCalls(), opts.getThreadCount(),
opts.getErrorCount(), opts.getTotalMillis());

Assert.assertEquals(0, opts.getErrorCount());

boolean correct = PerformanceProfileStore.checkPerformance(
getClass().getName() + "_measureThroughput_" + info, opts.getThroughput(), true);
Assert.assertTrue("performance regression", correct);
boolean correct = PerformanceProfileStore.checkPerformance(metricName, opts.getThroughput(), true);
Assert.assertTrue(metricName + ": performance regression", correct);
}

private class RTSWorker implements WorkerWorkload<String> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public boolean updateMetric(float variance, String metricName, Float metricValue
}
}

return isWithinTolerance(metricValue, canonicalValue, variance, largerIsBetter);
return isWithinTolerance(metricName, metricValue, canonicalValue, variance, largerIsBetter);
}

public static boolean checkPerformance(String performanceName, float operationDuration) throws IOException {
Expand All @@ -147,7 +147,7 @@ public static boolean checkPerformance(String performanceName, float variance, f
return metrics.updateMetric(variance, performanceName, operationDuration, largerIsBetter);
}

boolean isWithinTolerance(Float metricValue, Float canonicalValue, Float variance, boolean largerIsBetter) {
boolean isWithinTolerance(String metricName, Float metricValue, Float canonicalValue, Float variance, boolean largerIsBetter) {
Float headRoom = Math.abs(canonicalValue * (variance - 1));
boolean within;

Expand All @@ -158,8 +158,8 @@ boolean isWithinTolerance(Float metricValue, Float canonicalValue, Float varianc

boolean ok = within || !failOnRegression;

System.out.printf("actual %f versus best %f: _variance %f: head room: %f biggerBetter=%b within=%b (persist=%b failOnRegression=%b res=%b)%n",
metricValue, canonicalValue, variance, headRoom, largerIsBetter, within, PERSIST_DATA, failOnRegression, ok);
System.out.printf("%s: actual %f versus best %f: _variance %f: head room: %f biggerBetter=%b within=%b (persist=%b failOnRegression=%b res=%b)%n",
metricName, metricValue, canonicalValue, variance, headRoom, largerIsBetter, within, PERSIST_DATA, failOnRegression, ok);

return ok;
}
Expand Down

0 comments on commit 30cb74c

Please sign in to comment.