1 11 package org.eclipse.test.internal.performance.eval; 12 13 import org.eclipse.test.internal.performance.PerformanceTestPlugin; 14 import org.eclipse.test.internal.performance.data.Dim; 15 16 19 public class RelativeBandChecker extends AssertChecker { 20 21 private final double fLowerBand; 22 private final double fUpperBand; 23 24 public RelativeBandChecker(Dim dimension, double lowerBand, double upperBand) { 25 super(dimension); 26 fLowerBand= lowerBand; 27 fUpperBand= upperBand; 28 } 29 30 public boolean test(StatisticsSession reference, StatisticsSession measured, StringBuffer message) { 31 Dim dimension= getDimension(); 32 33 if (!measured.contains(dimension)) { 34 PerformanceTestPlugin.logWarning("collected data provides no dimension '"+dimension.getName()+'\''); return true; 36 } 37 if (!reference.contains(dimension)) { 38 PerformanceTestPlugin.logWarning("reference data provides no dimension '"+dimension.getName()+'\''); return true; 40 } 41 42 double actual= measured.getAverage(dimension); 43 double test= reference.getAverage(dimension); 44 45 if (test < 0.001 && test > -0.001) { 46 PerformanceTestPlugin.logWarning("ref value for '"+dimension.getName()+"' is too small"); return true; 49 } 50 if (actual < 0) { 51 PerformanceTestPlugin.logWarning("actual value for '"+dimension.getName()+"' is negative"); return true; 54 } 55 56 if (actual > fUpperBand * test || actual < fLowerBand * test) { 57 message.append('\n' + dimension.getName() + ": " + dimension.getDisplayValue(actual) + " is not within [" + Math.round(fLowerBand * 100)+ "%, " + Math.round(fUpperBand * 100) + "%] of " + dimension.getDisplayValue(test)); return false; 59 } 60 return true; 61 } 62 } 63 | Popular Tags |