jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ju...@apache.org
Subject svn commit: r981952 - in /jackrabbit/trunk/jackrabbit-core/src/test/performance: README.txt base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
Date Tue, 03 Aug 2010 16:17:18 GMT
Author: jukka
Date: Tue Aug  3 16:17:18 2010
New Revision: 981952

URL: http://svn.apache.org/viewvc?rev=981952&view=rev
Log:
JCR-2695: Jackrabbit performance test suite

Add a README. Improved reporting.

Added:
    jackrabbit/trunk/jackrabbit-core/src/test/performance/README.txt   (with props)
Modified:
    jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java

Added: jackrabbit/trunk/jackrabbit-core/src/test/performance/README.txt
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/README.txt?rev=981952&view=auto
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/README.txt (added)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/README.txt Tue Aug  3 16:17:18 2010
@@ -0,0 +1,15 @@
+---------------------------------
+Jackrabbit Performance Test Suite
+---------------------------------
+
+This directory contains a simple performance test suite that covers all
+major and minor Jackrabbit releases since 1.0. Use the following command
+to run this test suite:
+
+    mvn clean install
+
+Note that the test suite will take more than an hour to complete, and to
+avoid distorting the results you should avoid putting any extra load on
+the computer while the test suite is running.
+
+The results are stored as jackrabbit*/target/performance-*.txt report files.

Propchange: jackrabbit/trunk/jackrabbit-core/src/test/performance/README.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java?rev=981952&r1=981951&r2=981952&view=diff
==============================================================================
--- jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
(original)
+++ jackrabbit/trunk/jackrabbit-core/src/test/performance/base/src/main/java/org/apache/jackrabbit/performance/AbstractPerformanceTest.java
Tue Aug  3 16:17:18 2010
@@ -22,6 +22,7 @@ import java.io.ByteArrayInputStream;
 import java.io.File;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.io.PrintWriter;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Random;
@@ -35,8 +36,10 @@ import javax.jcr.version.VersionHistory;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
+import org.apache.commons.math.stat.descriptive.SummaryStatistics;
 import org.apache.jackrabbit.core.RepositoryImpl;
 import org.apache.jackrabbit.core.config.RepositoryConfig;
+import org.apache.jackrabbit.benchmark.PerformanceTest;
 import org.apache.jackrabbit.benchmark.PerformanceTestSuite;
 import org.apache.jackrabbit.benchmark.LoginTest;
 import org.apache.jackrabbit.benchmark.LoginLogoutTest;
@@ -69,35 +72,60 @@ public abstract class AbstractPerformanc
         }
     }
 
-    protected void testPerformance(String name, InputStream xml)
+    private void testPerformance(String name, InputStream xml)
             throws Exception {
         RepositoryImpl repository = createRepository(name, xml);
         try {
-            System.out.format(
-                    "%-36.36s     avg     std     min     max       n%n",
+            testPerformance(name, repository);
+        } finally {
+            repository.shutdown();
+        }
+    }
+
+    private void testPerformance(String name, RepositoryImpl repository)
+            throws Exception {
+        File report = new File("target", "performance-" + name + ".txt");
+        PrintWriter writer = new PrintWriter(report, "UTF-8");
+        try {
+            writer.format(
+                    "%-36.36s     avg     std     min     max   count%n",
                     name);
-            System.out.println(
+            writer.println(
                     "--------------------------------------"
                     + "--------------------------------------");
 
             PerformanceTestSuite suite = new PerformanceTestSuite(
                     repository,
                     new SimpleCredentials("admin", "admin".toCharArray()));
-            suite.runTest(new LoginTest());
-            suite.runTest(new LoginLogoutTest());
-            suite.runTest(new SmallFileReadTest());
-            suite.runTest(new SmallFileWriteTest());
-            suite.runTest(new BigFileReadTest());
-            suite.runTest(new BigFileWriteTest());
+            runTest(suite, new LoginTest(), writer);
+            runTest(suite, new LoginLogoutTest(), writer);
+            runTest(suite, new SmallFileReadTest(), writer);
+            runTest(suite, new SmallFileWriteTest(), writer);
+            runTest(suite, new BigFileReadTest(), writer);
+            runTest(suite, new BigFileWriteTest(), writer);
 
-            System.out.println(
+            writer.println(
                     "--------------------------------------"
                     + "--------------------------------------");
         } finally {
-            repository.shutdown();
+            writer.close();
         }
     }
 
+    private void runTest(
+            PerformanceTestSuite suite, PerformanceTest test,
+            PrintWriter writer) throws Exception {
+        SummaryStatistics statistics = suite.runTest(test);
+        writer.format(
+                "%-36.36s  %6.0f  %6.0f  %6.0f  %6.0f  %6d%n",
+                test,
+                statistics.getMean(),
+                statistics.getStandardDeviation(),
+                statistics.getMin(),
+                statistics.getMax(),
+                statistics.getN());
+    }
+
     /**
      * Creates a named test repository with the given configuration file.
      *



Mime
View raw message