[jbosscache-commits] JBoss Cache SVN: r5281 - benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators.

jbosscache-commits at lists.jboss.org jbosscache-commits at lists.jboss.org
Thu Jan 31 06:52:54 EST 2008


Author: manik.surtani at jboss.com
Date: 2008-01-31 06:52:54 -0500 (Thu, 31 Jan 2008)
New Revision: 5281

Modified:
   benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java
Log:
sorting of keys

Modified: benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java
===================================================================
--- benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java	2008-01-31 11:32:39 UTC (rev 5280)
+++ benchmarks/benchmark-fwk/trunk/src/org/cachebench/reportgenerators/ChartGenerator.java	2008-01-31 11:52:54 UTC (rev 5281)
@@ -16,7 +16,10 @@
 import java.io.FilenameFilter;
 import java.io.IOException;
 import java.util.Date;
+import java.util.Map;
+import java.util.SortedMap;
 import java.util.StringTokenizer;
+import java.util.TreeMap;
 
 /**
  * Manual chart generator.  Grabs CSVs generated by {@link org.cachebench.reportgenerators.ClusterReportGenerator} and spits out
@@ -134,8 +137,44 @@
       {
          readData(f);
       }
+
+      sort(averageThroughput);
+      sort(totalThroughput);
    }
 
+   /**
+    * Crappy that the JFReechart data set doesn't order columns and rows by default or even as an option.  Need to do this manually.
+    *
+    * @param data
+    */
+   private void sort(DefaultCategoryDataset data)
+   {
+      SortedMap<Comparable, SortedMap<Comparable, Number>> raw = new TreeMap<Comparable, SortedMap<Comparable, Number>>();
+      for (int i = 0; i < data.getRowCount(); i++)
+      {
+         Comparable row = data.getRowKey(i);
+         SortedMap<Comparable, Number> rowData = new TreeMap<Comparable, Number>();
+         for (int j = 0; j < data.getColumnCount(); j++)
+         {
+            Comparable column = data.getColumnKey(j);
+            Number value = data.getValue(i, j);
+            rowData.put(column, value);
+         }
+         raw.put(row, rowData);
+      }
+
+      data.clear();
+      for (Comparable row : raw.keySet())
+      {
+         Map<Comparable, Number> rowData = raw.get(row);
+         for (Comparable column : rowData.keySet())
+         {
+            data.addValue(rowData.get(column), row, column);
+         }
+      }
+   }
+
+
    private void readData(File f) throws IOException
    {
       // chop up the file name to get productAndConfiguration and clusterSize.




More information about the jbosscache-commits mailing list