Search in sources :

Example 11 with DataPoint

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

the class InternalPerformanceMeter method printSampleCSV.

void printSampleCSV(PrintStream ps, Sample sample) {
    final char SEPARATOR = '\t';
    DataPoint[] dataPoints = sample.getDataPoints();
    if (dataPoints.length > 0) {
        Dim[] dimensions = dataPoints[0].getDimensions();
        Arrays.sort(dimensions, new DimensionComparator());
        if (dimensions.length > 0) {
            /* print dimensions */
            for (Dim dimension : dimensions) {
                ps.print(dimension.getName());
                ps.print(SEPARATOR);
            }
            // $NON-NLS-1$
            ps.println("scenario");
            for (int p = 0; p < dataPoints.length - 1; p += 2) {
                DataPoint before = dataPoints[p];
                DataPoint after = dataPoints[p + 1];
                for (Dim dimension : dimensions) {
                    long valBefore = before.getScalar(dimension).getMagnitude();
                    long valAfter = after.getScalar(dimension).getMagnitude();
                    ps.print(valAfter - valBefore);
                    ps.print(SEPARATOR);
                }
                ps.print(sample.getShortname() != null ? sample.getShortname() : sample.getScenarioID());
                ps.println();
            }
            ps.println();
        }
    }
}
Also used : DataPoint(org.eclipse.test.internal.performance.data.DataPoint) Dim(org.eclipse.test.internal.performance.data.Dim) DataPoint(org.eclipse.test.internal.performance.data.DataPoint)

Example 12 with DataPoint

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

the class OSPerformanceMeter method snapshot.

// ---- private stuff ------
private void snapshot(int step) {
    HashMap map = new HashMap();
    fPerformanceMonitor.collectOperatingSystemCounters(map);
    fDataPoints.add(new DataPoint(step, map));
}
Also used : HashMap(java.util.HashMap) DataPoint(org.eclipse.test.internal.performance.data.DataPoint)

Example 13 with DataPoint

use of org.eclipse.test.internal.performance.data.DataPoint 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 14 with DataPoint

use of org.eclipse.test.internal.performance.data.DataPoint 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

DataPoint (org.eclipse.test.internal.performance.data.DataPoint)14 Dim (org.eclipse.test.internal.performance.data.Dim)8 Scalar (org.eclipse.test.internal.performance.data.Scalar)6 HashMap (java.util.HashMap)5 ArrayList (java.util.ArrayList)4 HashSet (java.util.HashSet)4 Sample (org.eclipse.test.internal.performance.data.Sample)3 StatisticsSession (org.eclipse.test.internal.performance.eval.StatisticsSession)3 SQLException (java.sql.SQLException)2 Variations (org.eclipse.test.internal.performance.db.Variations)2 ResultSet (java.sql.ResultSet)1 Timestamp (java.sql.Timestamp)1 MessageFormat (java.text.MessageFormat)1 Map (java.util.Map)1 CoreException (org.eclipse.core.runtime.CoreException)1 InternalPerformanceMeter (org.eclipse.test.internal.performance.InternalPerformanceMeter)1 SummaryEntry (org.eclipse.test.internal.performance.db.SummaryEntry)1 Percentile (org.eclipse.test.internal.performance.eval.StatisticsUtil.Percentile)1 Dimension (org.eclipse.test.performance.Dimension)1 Performance (org.eclipse.test.performance.Performance)1