jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1527924 - in /jackrabbit/oak/trunk/oak-run: README.md src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
Date Tue, 01 Oct 2013 06:12:26 GMT
Author: thomasm
Date: Tue Oct  1 06:12:26 2013
New Revision: 1527924

URL: http://svn.apache.org/r1527924
Log:
OAK-641: Improved benchmark tooling - add an option to collect and print profiling info

Modified:
    jackrabbit/oak/trunk/oak-run/README.md
    jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java

Modified: jackrabbit/oak/trunk/oak-run/README.md
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/README.md?rev=1527924&r1=1527923&r2=1527924&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/README.md (original)
+++ jackrabbit/oak/trunk/oak-run/README.md Tue Oct  1 06:12:26 2013
@@ -47,6 +47,7 @@ Some system properties are also used to 
 
     -Dwarmup=5         - warmup time (in seconds)
     -Druntime=60       - how long a single benchmark should run (in seconds)
+    -Dprofile=true     - to collect and print profiling data
 
 The test case names like `ReadPropertyTest`, `SmallFileReadTest` and
 `SmallFileWriteTest` indicate the specific test case being run. You can

Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java?rev=1527924&r1=1527923&r2=1527924&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
(original)
+++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/benchmark/AbstractTest.java
Tue Oct  1 06:12:26 2013
@@ -28,6 +28,7 @@ import javax.jcr.Session;
 import javax.jcr.SimpleCredentials;
 
 import org.apache.commons.math.stat.descriptive.DescriptiveStatistics;
+import org.apache.jackrabbit.oak.benchmark.util.Profiler;
 import org.apache.jackrabbit.oak.fixture.RepositoryFixture;
 
 /**
@@ -40,6 +41,8 @@ abstract class AbstractTest extends Benc
     private static final long WARMUP = TimeUnit.SECONDS.toMillis(Long.getLong("warmup", 5));
 
     private static final long RUNTIME = TimeUnit.SECONDS.toMillis(Long.getLong("runtime",
60));
+    
+    private static final boolean PROFILE = Boolean.getBoolean("profile");
 
     private Repository repository;
 
@@ -50,6 +53,8 @@ abstract class AbstractTest extends Benc
     private List<Thread> threads;
 
     private volatile boolean running;
+    
+    private Profiler profiler;
 
     protected static int getScale(int def) {
         int scale = Integer.getInteger("scale", 0);
@@ -76,6 +81,9 @@ abstract class AbstractTest extends Benc
         this.running = true;
 
         beforeSuite();
+        if (PROFILE) {
+            profiler = new Profiler().startCollecting();
+        }
     }
 
     @Override
@@ -161,6 +169,11 @@ abstract class AbstractTest extends Benc
         for (Thread thread : threads) {
             thread.join();
         }
+        
+        if (profiler != null) {
+            System.out.println(profiler.stopCollecting().getTop(5));
+            profiler = null;
+        }
 
         afterSuite();
 



Mime
View raw message