[jbosscache-commits] JBoss Cache SVN: r5793 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators.
jbosscache-commits at lists.jboss.org
jbosscache-commits at lists.jboss.org
Fri May 2 06:36:40 EDT 2008
Author: manik.surtani at jboss.com
Date: 2008-05-02 06:36:40 -0400 (Fri, 02 May 2008)
New Revision: 5793
Modified:
benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java
Log:
Added ability to specify output file name prefix
Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java 2008-05-01 17:10:29 UTC (rev 5792)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java 2008-05-02 10:36:40 UTC (rev 5793)
@@ -40,13 +40,14 @@
static String reportDirectory;
static boolean singleChart = true;
DefaultCategoryDataset averageThroughput, totalThroughput;
+ static String fnPrefix = null;
static String chartNameAverage = "chart-averageThroughput.png", chartNameTotal = "chart-totalThroughput.png";
private static void help()
{
System.out.println("Usage:");
- System.out.println(" ChartGenerator [-reportDir <directory containing CSV files>] [-singleChart <true | false> if true, generates a single chart for all config files.]");
+ System.out.println(" ChartGenerator [-reportDir <directory containing CSV files>] [-o <outputFileNamePrefix>] [-singleChart <true | false> if true, generates a single chart for all config files.]");
}
public static void main(String[] args) throws IOException
@@ -68,6 +69,12 @@
continue;
}
+ if (args[i].equals("-o"))
+ {
+ fnPrefix = args[++i];
+ continue;
+ }
+
help();
return;
}
@@ -79,31 +86,34 @@
}
if (!singleChart) throw new RuntimeException("Multiple charts not yet implemented");
new ChartGenerator().generateChart();
-
- System.out.println("Finished in " + ((System.currentTimeMillis() - startTime) / 1000) + " seconds! Charts saved as " + chartNameAverage + " and " + chartNameTotal);
+ System.out.println("Finished in " + ((System.currentTimeMillis() - startTime) / 1000) + " seconds!");
}
private void generateChart() throws IOException
{
readData();
- File chartFile = new File(chartNameAverage);
+ String chartAvgFileName = fnPrefix == null ? chartNameAverage : fnPrefix + "-" + chartNameAverage;
+ File chartFile = new File(chartAvgFileName);
if (chartFile.exists())
{
- chartFile.renameTo(new File(chartNameAverage + "." + System.currentTimeMillis()));
- chartFile = new File(chartNameAverage);
+ chartFile.renameTo(new File(chartAvgFileName + "." + System.currentTimeMillis()));
+ chartFile = new File(chartAvgFileName);
}
ChartUtilities.saveChartAsPNG(chartFile, createChart(averageThroughput, "Report: Average throughput per cache instance", "Throughput per cache instance (reqs/sec)"), 1024, 768);
- chartFile = new File(chartNameTotal);
+ String chartTotalFileName = fnPrefix == null ? chartNameTotal : fnPrefix + "-" + chartNameTotal;
+ chartFile = new File(chartTotalFileName);
if (chartFile.exists())
{
- chartFile.renameTo(new File(chartNameTotal + "." + System.currentTimeMillis()));
- chartFile = new File(chartNameTotal);
+ chartFile.renameTo(new File(chartTotalFileName + "." + System.currentTimeMillis()));
+ chartFile = new File(chartTotalFileName);
}
ChartUtilities.saveChartAsPNG(chartFile, createChart(totalThroughput, "Report: Total throughput for cluster", "Overall throughput (reqs/sec)"), 1024, 768);
+
+ System.out.println("Charts saved as " + chartAvgFileName + " and " + chartTotalFileName);
}
private JFreeChart createChart(CategoryDataset data, String title, String yLabel)
More information about the jbosscache-commits
mailing list