changeset 167:5e7437c54403

Prune RunResult statistics in favor of Result-s statistics.
author shade
date Thu, 29 Aug 2013 22:48:19 +0400
parents ea6a8e0d0efc
children 48fd68662be4
files jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java
diffstat 3 files changed, 4 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java	Thu Aug 29 22:38:14 2013 +0400
+++ b/jmh-api-samples/src/main/java/org/openjdk/jmh/SimpleTest.java	Thu Aug 29 22:48:19 2013 +0400
@@ -53,7 +53,7 @@
         Result result = runResult.getPrimaryResult();
 
         System.out.println();
-        System.out.println("API replied benchmark score: " + result.getScore() + " " + result.getScoreUnit() + " over " + runResult.getPrimaryStatistics().getN() + " iterations");
+        System.out.println("API replied benchmark score: " + result.getScore() + " " + result.getScoreUnit() + " over " + result.getStatistics().getN() + " iterations");
     }
 
 }
--- a/jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java	Thu Aug 29 22:38:14 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/logic/results/internal/RunResult.java	Thu Aug 29 22:48:19 2013 +0400
@@ -106,29 +106,6 @@
         return getPrimaryResult().getScoreUnit();
     }
 
-    public Statistics getPrimaryStatistics() {
-        Statistics s = new Statistics();
-        for (IterationResult d : iterationResults) {
-            s.addValue(d.getPrimaryResult().getScore());
-        }
-        return s;
-    }
-
-    public Map<String, Statistics> getSecondaryStatistics() {
-        Map<String, Statistics> answer = new HashMap<String, Statistics>();
-        for (IterationResult d : iterationResults) {
-            for (Map.Entry<String, Result> e : d.getSecondaryResults().entrySet()) {
-                Statistics s = answer.get(e.getKey());
-                if (s == null) {
-                    s = new Statistics();
-                    answer.put(e.getKey(), s);
-                }
-                s.addValue(e.getValue().getScore());
-            }
-        }
-        return answer;
-    }
-
     public static RunResult merge(RunResult... rrs) {
         List<IterationResult> rs = new ArrayList<IterationResult>();
         for (RunResult rr : rrs) {
--- a/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 22:38:14 2013 +0400
+++ b/jmh-core/src/main/java/org/openjdk/jmh/output/format/TextReportFormat.java	Thu Aug 29 22:48:19 2013 +0400
@@ -119,7 +119,7 @@
                 RunResult runResult = new RunResult(results);
 
                 {
-                    Statistics stats = runResult.getPrimaryStatistics();
+                    Statistics stats = runResult.getPrimaryResult().getStatistics();
                     if (stats.getN() > 2) {
                         interval = stats.getConfidenceInterval(0.01);
                     }
@@ -133,8 +133,8 @@
                             runResult.getScoreUnit());
                 }
 
-                for (String label : runResult.getSecondaryStatistics().keySet()) {
-                    Statistics stats = runResult.getSecondaryStatistics().get(label);
+                for (String label : runResult.getSecondaryResults().keySet()) {
+                    Statistics stats = runResult.getSecondaryResults().get(label).getStatistics();
                     if (stats.getN() > 2) {
                         interval = stats.getConfidenceInterval(0.01);
                     }