[jbosscache-commits] JBoss Cache SVN: r6305 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Jul 16 11:05:37 EDT 2008
Author: mircea.markus
Date: 2008-07-16 11:05:37 -0400 (Wed, 16 Jul 2008)
New Revision: 6305
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
Log:
increased test accuracy and added support for nanos
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-07-16 15:03:07 UTC (rev 6304)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/SessionSimulatorTest.java 2008-07-16 15:05:37 UTC (rev 6305)
@@ -27,6 +27,7 @@
private TestConfig thisTestConfig;
private String sessionId;
private CacheWrapper cacheWrapper;
+ private boolean reportNanos = false;
/**
@@ -76,7 +77,7 @@
Random r = new Random();
int randomAction;
int randomAttribute;
- long start = System.currentTimeMillis();
+ long durrationNanos = 0;
for (int i = 0; i < numberOfRequests; i++)
{
logRunCount(i);
@@ -87,7 +88,9 @@
{ // read
try
{
+ long start = System.nanoTime();
buf = (byte[]) cacheWrapper.get(getSessionEntry(randomAttribute));
+ durrationNanos += System.nanoTime() - start;
totalBytesRead += buf.length;
reads++;
}
@@ -101,7 +104,9 @@
buf = new byte[this.sizeOfAnAttribute];
try
{
+ long start = System.nanoTime();
cacheWrapper.put(getSessionEntry(randomAttribute), buf);
+ durrationNanos += System.nanoTime() - start;
totalBytesWritten += buf.length;
writes++;
}
@@ -111,7 +116,7 @@
}
}
}
- long durration = System.currentTimeMillis() - start;
+ long durration = this.reportNanos ? durrationNanos : durrationNanos / 1000000;
SessionSimulatorTestResult result = new SessionSimulatorTestResult(reads, writes, durration, totalBytesRead, totalBytesWritten);
result.setTestPassed(true);
result.setTestName(testCaseName + getNodeIndex());
@@ -157,6 +162,10 @@
numberOfAttributes = thisTestConfig.getIntValue("numberOfAttributes");
writePercentage = thisTestConfig.getIntValue("writePercentage");
sizeOfAnAttribute = thisTestConfig.getIntValue("sizeOfAnAttribute");
+ if (thisTestConfig.existsParam("reportNanos"))
+ {
+ this.reportNanos = Boolean.valueOf(thisTestConfig.getParamValue("reportNanos"));
+ }
log.debug("recieved follosing params[ numberOfRequests=" + numberOfRequests + ", numberOfAttributes="
+ numberOfAttributes + ", writePercentage=" + writePercentage + ", sizeOfAnAttribute=" + sizeOfAnAttribute + " ]");
}
More information about the jbosscache-commits
mailing list