Performance test: add options.postWarmup

Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/9f758bf5
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/9f758bf5
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/9f758bf5

Branch: refs/heads/master
Commit: 9f758bf5b5678c5480299b97a564e46264a6148c
Parents: 3f36a29
Author: Aled Sage <[email protected]>
Authored: Tue Jun 6 13:01:21 2017 +0100
Committer: Aled Sage <[email protected]>
Committed: Fri Jun 16 13:32:09 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/test/performance/PerformanceMeasurer.java      | 2 ++
 .../test/performance/PerformanceTestDescriptor.java         | 9 +++++++++
 2 files changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9f758bf5/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceMeasurer.java
----------------------------------------------------------------------
diff --git 
a/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceMeasurer.java
 
b/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceMeasurer.java
index 6aef945..28a7043 100644
--- 
a/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceMeasurer.java
+++ 
b/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceMeasurer.java
@@ -86,6 +86,8 @@ public class PerformanceMeasurer {
         }
         warmupWatch.stop();
         
+        if (options.postWarmup != null) options.postWarmup.run();
+        
         // Run the actual test (for the given duration / iterations); then 
wait for completionLatch (if supplied).
         nextLogTime = (options.logInterval == null) ? Long.MAX_VALUE : 
options.logInterval.toMilliseconds();
         int counter = 0;

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9f758bf5/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceTestDescriptor.java
----------------------------------------------------------------------
diff --git 
a/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceTestDescriptor.java
 
b/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceTestDescriptor.java
index f75763f..54715ad 100644
--- 
a/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceTestDescriptor.java
+++ 
b/test-support/src/main/java/org/apache/brooklyn/test/performance/PerformanceTestDescriptor.java
@@ -60,6 +60,7 @@ public class PerformanceTestDescriptor {
     public Runnable job;
     public Runnable preJob;
     public Runnable postJob;
+    public Runnable postWarmup;
     public CountDownLatch completionLatch;
     public Duration completionLatchTimeout = Duration.FIVE_MINUTES;
     public Double minAcceptablePerSecond;
@@ -167,6 +168,14 @@ public class PerformanceTestDescriptor {
     }
     
     /**
+     * To be run once, after the warmup.
+     */
+    public PerformanceTestDescriptor postWarmup(Runnable val) {
+        if (sealed) throw new IllegalStateException("Should not modify after 
sealed (e.g. after use)");
+        this.postWarmup = val; return this;
+    }
+    
+    /**
      * If non-null, the performance test will wait for this latch before 
stopping the timer.
      * This is useful for asynchronous work. For example, 1000 iterations of 
the job might
      * be executed that each submits work asynchronously, and then the latch 
signals when all

Reply via email to