You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2012/01/16 19:18:30 UTC

svn commit: r1232092 - in /cxf/branches/2.5.x-fixes: ./ benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java

Author: dkulp
Date: Mon Jan 16 18:18:30 2012
New Revision: 1232092

URL: http://svn.apache.org/viewvc?rev=1232092&view=rev
Log:
Merged revisions 1231830 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/trunk

........
  r1231830 | ema | 2012-01-15 23:16:50 -0500 (Sun, 15 Jan 2012) | 1 line
  
  Add the overall beanchmar result for all TestRunners
........

Modified:
    cxf/branches/2.5.x-fixes/   (props changed)
    cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java
    cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java

Propchange: cxf/branches/2.5.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java?rev=1232092&r1=1232091&r2=1232092&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java (original)
+++ cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java Mon Jan 16 18:18:30 2012
@@ -299,6 +299,24 @@ public abstract class TestCaseBase<T> {
                 e.printStackTrace();
             }
         }
+        printResult();
+    }
+    private void printResult() {
+        double totalDuration = 0;
+        double totalInvocations = 0;
+        for (TestResult testResult : results) {
+            totalDuration = totalDuration + testResult.getDuration();
+            totalInvocations = totalInvocations + testResult.getNumOfInvocations();
+        }
+        double totalThroughput = totalInvocations/totalDuration;
+        double totalAvgResponseTime = totalDuration/totalInvocations;
+        System.out.println();
+        System.out.println("=============Overall Test Result============");
+        System.out.println("Overall Throughput: " + this.getOperationName() + " " + totalThroughput + TestResult.THROUGHPUT_UNIT);
+        System.out.println("Overall AVG. response time: " + totalAvgResponseTime * 1000 + TestResult.AVG_UNIT);
+        System.out.println(totalInvocations + " (invocations), running " + totalDuration  + " (sec) ");
+        System.out.println("============================================");
+        
     }
 
     public void run() {

Modified: cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java
URL: http://svn.apache.org/viewvc/cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java?rev=1232092&r1=1232091&r2=1232092&view=diff
==============================================================================
--- cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java (original)
+++ cxf/branches/2.5.x-fixes/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java Mon Jan 16 18:18:30 2012
@@ -21,11 +21,14 @@ package org.apache.cxf.pat.internal;
 
 public class TestResult {
     public static final String AVG_UNIT = " (ms)";
-    private static final String THROUGHPUT_UNIT = " (invocations/sec)";
+    public static final String THROUGHPUT_UNIT = " (invocations/sec)";
     
     private String name;
     private TestCaseBase testCase;
   
+    private double duration;
+    private double numOfInvocations;
+    
     private double avgResponseTime;
     private double throughput;
   
@@ -43,15 +46,17 @@ public class TestResult {
     }
 
     public void compute(long startTime, long endTime, int numberOfInvocations) {
-        double numOfInvocations = (double)numberOfInvocations;
-        double duration = convertToSeconds(endTime - startTime);
+        numOfInvocations = (double)numberOfInvocations;
+        duration = convertToSeconds(endTime - startTime);
       
         throughput = numOfInvocations / duration;
         avgResponseTime  = duration / numOfInvocations;
-    
+        System.out.println();
+        System.out.println("--------------Test Result of " +  this.getName() + "-------------");
         System.out.println("Throughput: " + testCase.getOperationName() + " " + throughput + THROUGHPUT_UNIT);
         System.out.println("AVG. response time: " + avgResponseTime * 1000 + AVG_UNIT);
         System.out.println(numOfInvocations + " (invocations), running " + duration  + " (sec) ");
+        System.out.println("---------------------------------------------------------");
 
     }
 
@@ -70,4 +75,12 @@ public class TestResult {
     public double getThroughput() {
         return throughput;
     }
+    
+    public double getDuration() {
+        return duration;
+    }
+    
+    public double getNumOfInvocations() {
+        return numOfInvocations;
+    }
 }