[jbosscache-commits] JBoss Cache SVN: r6301 - in benchmarks/benchmark-fwk/trunk/src/org/cachebench: tests/simpletests and 1 other directory.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Wed Jul 16 09:40:26 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-07-16 09:40:26 -0400 (Wed, 16 Jul 2008)
New Revision: 6301
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java
Log:
Measures in Nanos now
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java 2008-07-16 13:39:53 UTC (rev 6300)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/PutGetChartGenerator.java 2008-07-16 13:40:26 UTC (rev 6301)
@@ -28,28 +28,29 @@
public class PutGetChartGenerator extends AbstractChartGen
{
private DefaultCategoryDataset putData, getData;
- private String putChartName = "PutChart.png", getChartName = "GetChart.png";
+ private String chartExtension = ".png";
+ private String putChartName = "PutChart", getChartName = "GetChart";
public void generateChart() throws IOException
{
readData();
String putChartNameToUse = filenamePrefix == null ? putChartName : filenamePrefix + "-" + putChartName;
- File chartFile = new File(putChartNameToUse);
+ File chartFile = new File(putChartNameToUse + chartExtension);
if (chartFile.exists())
{
- chartFile.renameTo(new File(putChartNameToUse + "." + System.currentTimeMillis()));
- chartFile = new File(putChartNameToUse);
+ chartFile.renameTo(new File(putChartNameToUse + "." + System.currentTimeMillis() + chartExtension));
+ chartFile = new File(putChartNameToUse + chartExtension);
}
ChartUtilities.saveChartAsPNG(chartFile, createChart("Report: Comparing Cache PUT (WRITE) performance", putData), 800, 800);
String getChartNameToUse = filenamePrefix == null ? getChartName : filenamePrefix + "-" + getChartName;
- chartFile = new File(getChartNameToUse);
+ chartFile = new File(getChartNameToUse + chartExtension);
if (chartFile.exists())
{
- chartFile.renameTo(new File(getChartNameToUse + "." + System.currentTimeMillis()));
- chartFile = new File(getChartNameToUse);
+ chartFile.renameTo(new File(getChartNameToUse + "." + System.currentTimeMillis() + chartExtension));
+ chartFile = new File(getChartNameToUse + chartExtension);
}
ChartUtilities.saveChartAsPNG(chartFile, createChart("Report: Comparing Cache GET (READ) performance", getData), 800, 800);
@@ -177,8 +178,8 @@
double[] results = new double[2];
try
{
- results[0] = Double.parseDouble(putStr) * 1000;
- results[1] = Double.parseDouble(getStr) * 1000;
+ results[0] = Double.parseDouble(putStr) / 1000;
+ results[1] = Double.parseDouble(getStr) / 1000;
return results;
}
catch (NumberFormatException nfe)
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java 2008-07-16 13:39:53 UTC (rev 6300)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/tests/simpletests/SimpleTest.java 2008-07-16 13:40:26 UTC (rev 6301)
@@ -5,23 +5,21 @@
import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
import org.cachebench.CacheWrapper;
import org.cachebench.SerializableCacheWrapper;
+import org.cachebench.config.Configuration;
+import org.cachebench.tests.CacheTest;
import org.cachebench.tests.results.StatisticTestResult;
-import org.cachebench.tests.CacheTest;
-import org.cachebench.config.Configuration;
-import java.io.Serializable;
import java.io.ByteArrayOutputStream;
import java.io.ObjectOutputStream;
+import java.io.Serializable;
import java.util.Date;
+import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicLong;
/**
- *
- *
* @author Manik Surtani (manik at surtani.org)
* (C) Manik Surtani, 2004
*/
@@ -83,7 +81,6 @@
result.setThroughputBytesPerSecond(-999);
}
-
// set the number of members in the cluster
result.setNumMembers(cache.getNumMembers());
result.setNumThreads(numThreads);
@@ -115,18 +112,18 @@
if (!useSerializable)
{
// start your timer...
- long startTime = System.currentTimeMillis();
+ long startTime = System.nanoTime();
cache.get(key + cycleNumber);
- long statValue = (System.currentTimeMillis() - startTime);
+ long statValue = (System.nanoTime() - startTime);
stats.addValue(statValue);
log.debug("The Get stat : " + statValue);
}
else
{
SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
- long startTime = System.currentTimeMillis();
+ long startTime = System.nanoTime();
sCache.getSerializable(key + cycleNumber);
- long statValue = (System.currentTimeMillis() - startTime);
+ long statValue = (System.nanoTime() - startTime);
stats.addValue(statValue);
log.debug("The Get stat : " + statValue);
}
@@ -174,7 +171,7 @@
final boolean useSerializable = cache instanceof SerializableCacheWrapper;
numberOfBytesPut.set(0);
elapsedSecondsForAllPuts = 0;
- long startElapsedTime = System.currentTimeMillis();
+ long startElapsedTime = System.nanoTime();
for (int i = 0; i < sampleSize; i++)
{
@@ -200,21 +197,21 @@
if (!useSerializable)
{
// start your timer...
- long startTime = System.currentTimeMillis();
+ long startTime = System.nanoTime();
cache.put(key + cycleNumber, value);
- long statValue = (System.currentTimeMillis() - startTime);
+ long statValue = (System.nanoTime() - startTime);
stats.addValue(statValue);
}
else
{
SerializableCacheWrapper sCache = (SerializableCacheWrapper) cache;
Serializable sValue = (Serializable) value;
- long startTime = System.currentTimeMillis();
+ long startTime = System.nanoTime();
sCache.putSerializable(key + cycleNumber, sValue);
- long statValue = (System.currentTimeMillis() - startTime);
+ long statValue = (System.nanoTime() - startTime);
stats.addValue(statValue);
}
- logOperation(cycleNumber,"PUTS");
+ logOperation(cycleNumber, "PUTS");
}
catch (Exception e)
{
@@ -229,8 +226,9 @@
// only leave once the task queue is empty!!
blockTillTasksComplete();
- elapsedSecondsForAllPuts = (System.currentTimeMillis() - startElapsedTime) / 1000;
+ elapsedSecondsForAllPuts = TimeUnit.NANOSECONDS.toSeconds(System.nanoTime() - startElapsedTime);
+
// return the raw data
log.debug("Leaving doPuts for " + cache);
return stats;
@@ -287,7 +285,9 @@
try
{
return " - " + Integer.parseInt(System.getProperty("currentIndex"));
- } catch (Exception e) {
+ }
+ catch (Exception e)
+ {
return "";
}
}
More information about the jbosscache-commits
mailing list