Author: ema
Date: Mon Jan 16 04:16:50 2012
New Revision: 1231830
URL: http://svn.apache.org/viewvc?rev=1231830&view=rev
Log:
Add the overall beanchmar result for all TestRunners
Modified:
cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java
cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java
Modified:
cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java?rev=1231830&r1=1231829&r2=1231830&view=diff
==============================================================================
---
cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java
(original)
+++
cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestCaseBase.java
Mon Jan 16 04:16:50 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/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java
URL:
http://svn.apache.org/viewvc/cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java?rev=1231830&r1=1231829&r2=1231830&view=diff
==============================================================================
---
cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java
(original)
+++
cxf/trunk/benchmark/performance/base/src/main/java/org/apache/cxf/pat/internal/TestResult.java
Mon Jan 16 04:16:50 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;
+ }
}