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 import org.eclipse.test.internal.performance.data.Scalar; 16 17 18 21 public class AbsoluteBandChecker extends AssertChecker { 22 23 private long fLowerBand; 24 private long fUpperBand; 25 26 public AbsoluteBandChecker(Dim dimension, long lowerBand, long upperBand) { 27 super(dimension); 28 fLowerBand= lowerBand; 29 fUpperBand= upperBand; 30 } 31 32 public boolean test(StatisticsSession reference, StatisticsSession measured, StringBuffer message) { 33 Dim dimension= getDimension(); 34 35 if (!measured.contains(dimension)) { 36 PerformanceTestPlugin.logWarning("collected data provides no dimension '"+dimension.getName()+'\''); return true; 38 } 39 if (!reference.contains(dimension)) { 40 PerformanceTestPlugin.logWarning("reference data provides no dimension '"+dimension.getName()+'\''); return true; 42 } 43 44 double actual= measured.getAverage(dimension); 45 double test= reference.getAverage(dimension); 46 47 if (actual > fUpperBand + test || actual < test - fLowerBand) { 48 message.append('\n' + dimension.getName() + ": " + dimension.getDisplayValue(actual) + " is not within [-" + dimension.getDisplayValue(new Scalar(null, fLowerBand)) + ", +" + dimension.getDisplayValue(new Scalar(null, fUpperBand)) + "] of " + dimension.getDisplayValue(test)); return false; 50 } 51 52 return true; 53 } 54 } 55 | Popular Tags |