1 11 package org.eclipse.test.performance; 12 13 import junit.framework.TestCase; 14 15 34 public class PerformanceTestCase extends TestCase { 35 36 protected PerformanceMeter fPerformanceMeter; 37 38 41 public PerformanceTestCase() { 42 super(); 43 } 44 45 49 public PerformanceTestCase(String name) { 50 super(name); 51 } 52 53 57 protected void setUp() throws Exception { 58 Performance performance= Performance.getDefault(); 59 fPerformanceMeter= performance.createPerformanceMeter(performance.getDefaultScenarioId(this)); 60 } 61 62 66 protected void tearDown() throws Exception { 67 fPerformanceMeter.dispose(); 68 } 69 70 78 public void tagAsGlobalSummary(String shortName, Dimension dimension) { 79 Performance performance= Performance.getDefault(); 80 performance.tagAsGlobalSummary(fPerformanceMeter, shortName, new Dimension[] { dimension } ); 81 } 82 83 91 public void tagAsGlobalSummary(String shortName, Dimension[] dimensions) { 92 Performance performance= Performance.getDefault(); 93 performance.tagAsGlobalSummary(fPerformanceMeter, shortName, dimensions ); 94 } 95 96 104 public void tagAsSummary(String shortName, Dimension dimension) { 105 Performance performance= Performance.getDefault(); 106 performance.tagAsSummary(fPerformanceMeter, shortName, new Dimension[] { dimension } ); 107 } 108 109 117 public void tagAsSummary(String shortName, Dimension[] dimensions) { 118 Performance performance= Performance.getDefault(); 119 performance.tagAsSummary(fPerformanceMeter, shortName, dimensions ); 120 } 121 122 131 public void setComment(int commentKind, String commentText) { 132 Performance performance= Performance.getDefault(); 133 performance.setComment(fPerformanceMeter, commentKind, commentText); 134 } 135 136 142 protected void startMeasuring() { 143 fPerformanceMeter.start(); 144 } 145 146 protected void stopMeasuring() { 147 fPerformanceMeter.stop(); 148 } 149 150 protected void commitMeasurements() { 151 fPerformanceMeter.commit(); 152 } 153 154 159 protected void assertPerformance() { 160 Performance.getDefault().assertPerformance(fPerformanceMeter); 161 } 162 163 173 protected void assertPerformanceInRelativeBand(Dimension dim, int lowerPercentage, int upperPercentage) { 174 Performance.getDefault().assertPerformanceInRelativeBand(fPerformanceMeter, dim, lowerPercentage, upperPercentage); 175 } 176 } 177 | Popular Tags |