Search in sources :

Example 11 with Dim

use of org.eclipse.test.internal.performance.data.Dim in project eclipse.platform.releng by eclipse.

the class Performance method assertPerformanceInAbsoluteBand.

/**
 * Asserts that the measurement specified by the dimension captured in the given performance meter is within a certain range
 * with respect to some reference value. If the performance meter doesn't provide the specified dimension, the call has no
 * effect.
 *
 * @param performanceMeter
 *            the performance meter
 * @param dim
 *            the Dimension to check
 * @param lowerBand
 *            a negative number indicating the absolute amount the measured value is allowed to be smaller than some reference
 *            value
 * @param upperBand
 *            a positive number indicating the absolute amount the measured value is allowed to be greater than some reference
 *            value
 * @throws RuntimeException
 *             if the properties do not hold
 */
public void assertPerformanceInAbsoluteBand(PerformanceMeter performanceMeter, Dimension dim, int lowerBand, int upperBand) {
    Evaluator e = new Evaluator();
    e.setAssertCheckers(new AssertChecker[] { new AbsoluteBandChecker((Dim) dim, lowerBand, upperBand) });
    e.evaluate(performanceMeter);
}
Also used : AbsoluteBandChecker(org.eclipse.test.internal.performance.eval.AbsoluteBandChecker) Dim(org.eclipse.test.internal.performance.data.Dim) Evaluator(org.eclipse.test.internal.performance.eval.Evaluator) IEvaluator(org.eclipse.test.internal.performance.eval.IEvaluator)

Example 12 with Dim

use of org.eclipse.test.internal.performance.data.Dim in project eclipse.platform.releng by eclipse.

the class DBTests method testBasicDBFunctionality.

public void testBasicDBFunctionality() {
    Performance perf = Performance.getDefault();
    TestPerformanceMeter pm1 = new TestPerformanceMeter(SCENARIO_NAME_1);
    pm1.addPair(InternalDimensions.CPU_TIME, 100, 1000);
    pm1.addPair(InternalDimensions.WORKING_SET, 1000, 2000);
    pm1.start();
    pm1.stop();
    pm1.commit();
    pm1.dispose();
    TestPerformanceMeter pm2 = new TestPerformanceMeter(SCENARIO_NAME_2);
    pm2.addPair(InternalDimensions.CPU_TIME, 100, 1000);
    pm2.addPair(InternalDimensions.WORKING_SET, 1000, 2000);
    perf.tagAsGlobalSummary(pm2, SHORT_NAME_2, new Dimension[] { Dimension.CPU_TIME, Dimension.USED_JAVA_HEAP });
    pm2.start();
    pm2.stop();
    pm2.commit();
    pm2.dispose();
    TestPerformanceMeter pm3 = new TestPerformanceMeter(SCENARIO_NAME_3);
    pm3.addPair(InternalDimensions.CPU_TIME, 100, 1000);
    pm3.addPair(InternalDimensions.WORKING_SET, 1000, 2000);
    perf.tagAsGlobalSummary(pm3, SHORT_NAME_3, Dimension.CPU_TIME);
    pm3.start();
    pm3.stop();
    pm3.commit();
    pm3.dispose();
    TestPerformanceMeter pm4 = new TestPerformanceMeter(SCENARIO_NAME_4);
    pm4.addPair(InternalDimensions.CPU_TIME, 100, 1000);
    pm4.addPair(InternalDimensions.WORKING_SET, 1000, 2000);
    perf.tagAsSummary(pm4, SHORT_NAME_4, Dimension.USED_JAVA_HEAP);
    pm4.start();
    pm4.stop();
    pm4.commit();
    pm4.dispose();
    // 
    Variations v = new Variations();
    // $NON-NLS-1$
    v.put(CONFIG, "test");
    // $NON-NLS-1$
    v.put(BUILD, "b0001");
    // $NON-NLS-1$ //$NON-NLS-2$
    v.put("jvm", "sun142");
    DataPoint[] points = DB.queryDataPoints(v, SCENARIO_NAME_1, null);
    assertEquals(1, points.length);
    DataPoint dp = points[0];
    Dim[] dimensions = dp.getDimensions();
    assertEquals(2, dimensions.length);
    Scalar s1 = dp.getScalar(InternalDimensions.CPU_TIME);
    assertNotNull(s1);
    assertEquals(900, s1.getMagnitude());
    Scalar s2 = dp.getScalar(InternalDimensions.WORKING_SET);
    assertNotNull(s2);
    assertEquals(1000, s2.getMagnitude());
    // 
    Set<Dim> dims = new HashSet<>();
    dims.add(InternalDimensions.WORKING_SET);
    points = DB.queryDataPoints(v, SCENARIO_NAME_1, dims);
    assertEquals(1, points.length);
    dimensions = points[0].getDimensions();
    assertEquals(1, dimensions.length);
    Scalar s = points[0].getScalar(InternalDimensions.WORKING_SET);
    assertNotNull(s);
    assertEquals(1000, s.getMagnitude());
    // 
    List<String> buildNames = new ArrayList<>();
    Variations v2 = new Variations();
    // $NON-NLS-1$
    v2.put(CONFIG, "%");
    // $NON-NLS-1$
    v2.put(BUILD, "b%");
    // $NON-NLS-1$
    DB.queryDistinctValues(buildNames, BUILD, v2, "%");
    assertEquals(1, buildNames.size());
    // $NON-NLS-1$
    assertEquals("b0001", buildNames.get(0));
    SummaryEntry[] fps = DB.querySummaries(PerformanceTestPlugin.getVariations(), null);
    assertEquals(3, fps.length);
    assertEquals(SCENARIO_NAME_2, fps[0].scenarioName);
    assertEquals(SHORT_NAME_2, fps[0].shortName);
    assertEquals(Dimension.USED_JAVA_HEAP, fps[0].dimension);
    assertEquals(SCENARIO_NAME_2, fps[1].scenarioName);
    assertEquals(SHORT_NAME_2, fps[1].shortName);
    assertEquals(Dimension.CPU_TIME, fps[1].dimension);
    assertEquals(SCENARIO_NAME_3, fps[2].scenarioName);
    assertEquals(SHORT_NAME_3, fps[2].shortName);
    assertEquals(Dimension.CPU_TIME, fps[2].dimension);
    // $NON-NLS-1$
    SummaryEntry[] fps2 = DB.querySummaries(PerformanceTestPlugin.getVariations(), "foo.%");
    assertEquals(2, fps2.length);
    assertEquals(SCENARIO_NAME_3, fps2[0].scenarioName);
    assertEquals(SHORT_NAME_3, fps2[0].shortName);
    assertEquals(Dimension.CPU_TIME, fps2[0].dimension);
    assertEquals(SCENARIO_NAME_4, fps2[1].scenarioName);
    assertEquals(SHORT_NAME_4, fps2[1].shortName);
    assertEquals(Dimension.USED_JAVA_HEAP, fps2[1].dimension);
}
Also used : Variations(org.eclipse.test.internal.performance.db.Variations) ArrayList(java.util.ArrayList) Dim(org.eclipse.test.internal.performance.data.Dim) Scalar(org.eclipse.test.internal.performance.data.Scalar) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) SummaryEntry(org.eclipse.test.internal.performance.db.SummaryEntry) Performance(org.eclipse.test.performance.Performance) HashSet(java.util.HashSet)

Example 13 with Dim

use of org.eclipse.test.internal.performance.data.Dim in project eclipse.platform.releng by eclipse.

the class SystemTimePerformanceMeter method createDataPoint.

private DataPoint createDataPoint(int step, Dim dimension, long value) {
    Map<Dim, Scalar> scalars = new HashMap<>();
    scalars.put(dimension, new Scalar(dimension, value));
    return new DataPoint(step, scalars);
}
Also used : HashMap(java.util.HashMap) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) Dim(org.eclipse.test.internal.performance.data.Dim) Scalar(org.eclipse.test.internal.performance.data.Scalar)

Aggregations

Dim (org.eclipse.test.internal.performance.data.Dim)13 DataPoint (org.eclipse.test.internal.performance.data.DataPoint)9 Scalar (org.eclipse.test.internal.performance.data.Scalar)5 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)3 StatisticsSession (org.eclipse.test.internal.performance.eval.StatisticsSession)3 SQLException (java.sql.SQLException)2 HashMap (java.util.HashMap)2 Variations (org.eclipse.test.internal.performance.db.Variations)2 Evaluator (org.eclipse.test.internal.performance.eval.Evaluator)2 IEvaluator (org.eclipse.test.internal.performance.eval.IEvaluator)2 ResultSet (java.sql.ResultSet)1 Timestamp (java.sql.Timestamp)1 MessageFormat (java.text.MessageFormat)1 CoreException (org.eclipse.core.runtime.CoreException)1 InternalPerformanceMeter (org.eclipse.test.internal.performance.InternalPerformanceMeter)1 Sample (org.eclipse.test.internal.performance.data.Sample)1 SummaryEntry (org.eclipse.test.internal.performance.db.SummaryEntry)1 AbsoluteBandChecker (org.eclipse.test.internal.performance.eval.AbsoluteBandChecker)1 RelativeBandChecker (org.eclipse.test.internal.performance.eval.RelativeBandChecker)1