1 11 12 package org.eclipse.test.internal.performance.tests; 13 14 import java.util.ArrayList ; 15 import java.util.HashMap ; 16 import java.util.List ; 17 import java.util.Map ; 18 19 import org.eclipse.test.internal.performance.InternalPerformanceMeter; 20 import org.eclipse.test.internal.performance.data.DataPoint; 21 import org.eclipse.test.internal.performance.data.Dim; 22 import org.eclipse.test.internal.performance.data.Sample; 23 import org.eclipse.test.internal.performance.data.Scalar; 24 25 26 29 class TestPerformanceMeter extends InternalPerformanceMeter { 30 31 private long fStartTime; 32 private List fDataPoints= new ArrayList (); 33 private Map fStart= new HashMap (); 34 private Map fStop= new HashMap (); 35 36 39 TestPerformanceMeter(String scenarioId) { 40 super(scenarioId); 41 fStartTime= System.currentTimeMillis(); 42 } 43 44 void addPair(Dim dimension, long start, long end) { 45 fStart.put(dimension, new Scalar(dimension, start)); 46 fStop.put(dimension, new Scalar(dimension, end)); 47 } 48 49 52 public void dispose() { 53 fDataPoints= null; 54 super.dispose(); 55 } 56 57 60 public Sample getSample() { 61 if (fDataPoints != null) 62 return new Sample(getScenarioName(), fStartTime, new HashMap (), (DataPoint[]) fDataPoints.toArray(new DataPoint[fDataPoints.size()])); 63 return null; 64 } 65 66 69 public void start() { 70 fDataPoints.add(new DataPoint(BEFORE, fStart)); 71 } 72 73 76 public void stop() { 77 fDataPoints.add(new DataPoint(AFTER, fStop)); 78 } 79 } 80 | Popular Tags |