You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by je...@apache.org on 2008/08/22 15:02:37 UTC

svn commit: r688078 - in /xmlgraphics/fop/trunk/test/java/org/apache/fop/memory: MemoryEater.java Stats.java

Author: jeremias
Date: Fri Aug 22 06:02:37 2008
New Revision: 688078

URL: http://svn.apache.org/viewvc?rev=688078&view=rev
Log:
Final statistics output after the test with average speed indication.

Modified:
    xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java
    xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/Stats.java

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java?rev=688078&r1=688077&r2=688078&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/MemoryEater.java Fri Aug 22 06:02:37 2008
@@ -52,7 +52,7 @@
     private FopFactory fopFactory = FopFactory.newInstance();
     private Templates replicatorTemplates;
 
-    private Stats stats = new Stats();
+    private Stats stats;
 
     public MemoryEater() throws TransformerConfigurationException, MalformedURLException {
         File xsltFile = new File("test/xsl/fo-replicator.xsl");
@@ -61,10 +61,12 @@
     }
 
     private void eatMemory(File foFile, int runRepeats, int replicatorRepeats) throws Exception {
+        stats = new Stats();
         for (int i = 0; i < runRepeats; i++) {
             eatMemory(i, foFile, replicatorRepeats);
             stats.progress(i, runRepeats);
         }
+        stats.dumpFinalStats();
         System.out.println(stats.getGoogleChartURL());
     }
 

Modified: xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/Stats.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/Stats.java?rev=688078&r1=688077&r2=688078&view=diff
==============================================================================
--- xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/Stats.java (original)
+++ xmlgraphics/fop/trunk/test/java/org/apache/fop/memory/Stats.java Fri Aug 22 06:02:37 2008
@@ -26,9 +26,12 @@
 
     private static final int INTERVAL = 2000;
 
-    private long lastProgressDump = System.currentTimeMillis();
+    private long startTime = System.currentTimeMillis();
+    private long lastProgressDump = startTime;
     private int pagesProduced;
 
+    private int totalPagesProduced;
+
     private int step;
     private int stepCount;
 
@@ -44,6 +47,7 @@
 
     public void notifyPagesProduced(int count) {
         pagesProduced += count;
+        totalPagesProduced += count;
     }
 
     public void reset() {
@@ -64,6 +68,14 @@
         samples.add(new Sample((int)ppm));
     }
 
+    public void dumpFinalStats() {
+        long duration = System.currentTimeMillis() - startTime;
+        System.out.println("Final statistics");
+        System.out.println("Pages produced: " +totalPagesProduced);
+        long ppm = 60000 * totalPagesProduced / duration;
+        System.out.println("Average speed: " + ppm + "ppm");
+    }
+
     public String getGoogleChartURL() {
         StringBuffer sb = new StringBuffer("http://chart.apis.google.com/chart?");
         //http://chart.apis.google.com/chart?cht=ls&chd=t:60,40&chs=250x100&chl=Hello|World



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org