Search in sources :

Example 6 with DataPoint

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

the class StatisticsSession method computeStats.

private Statistics computeStats(Dim dimension) {
    Statistics stats;
    Set<Integer> steps = new HashSet<>();
    for (int j = 0; j < fDataPoints.length; j++) {
        DataPoint dp = fDataPoints[j];
        steps.add(Integer.valueOf(dp.getStep()));
    }
    if (steps.contains(Integer.valueOf(InternalPerformanceMeter.AVERAGE))) {
        // an already aggregated set of data points from the DB
        stats = computeStatsFromAggregates(dimension);
    } else if (steps.contains(Integer.valueOf(InternalPerformanceMeter.AFTER))) {
        // raw values from measurement
        stats = computeStatsFromMeasurements(dimension, steps);
    } else {
        // $NON-NLS-1$
        Assert.fail("illegal data set: contains neither AVERAGE nor AFTER values.");
        // dummy
        stats = null;
    }
    return stats;
}
Also used : DataPoint(org.eclipse.test.internal.performance.data.DataPoint) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) HashSet(java.util.HashSet)

Example 7 with DataPoint

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

the class StatisticsSession method computeStatsFromMeasurements.

private Statistics computeStatsFromMeasurements(Dim dimension, Set<Integer> steps) {
    Statistics stats = new Statistics();
    long[] mags;
    switch(steps.size()) {
        case 1:
            // if there is only one Step, we don't calculate the delta. happens for startup tests
            mags = new long[fDataPoints.length];
            for (int i = 0; i < fDataPoints.length; i++) {
                Scalar sc = fDataPoints[i].getScalar(dimension);
                mags[i] = sc == null ? 0 : sc.getMagnitude();
            }
            break;
        case 2:
            int count = fDataPoints.length / 2;
            mags = new long[count];
            for (int i = 0; i < count; i++) {
                DataPoint before = fDataPoints[2 * i];
                // $NON-NLS-1$
                Assert.assertTrue("wrong order of steps", before.getStep() == InternalPerformanceMeter.BEFORE);
                DataPoint after = fDataPoints[2 * i + 1];
                // $NON-NLS-1$
                Assert.assertTrue("wrong order of steps", after.getStep() == InternalPerformanceMeter.AFTER);
                Scalar delta = getDelta(before, after, dimension);
                long magnitude = delta.getMagnitude();
                mags[i] = magnitude;
            }
            break;
        default:
            // $NON-NLS-1$
            Assert.fail("cannot handle more than two steps in measurement mode");
            // dummy
            return null;
    }
    for (int i = 0; i < mags.length; i++) {
        stats.sum += mags[i];
        stats.count++;
    }
    if (stats.count > 0) {
        stats.average = (double) stats.sum / stats.count;
        if (stats.count == 1) {
            stats.stddev = 0;
        } else {
            double squaredDeviations = 0;
            for (int i = 0; i < mags.length; i++) {
                double deviation = stats.average - mags[i];
                squaredDeviations += deviation * deviation;
            }
            // unbiased sample stdev
            stats.stddev = Math.sqrt(squaredDeviations / (stats.count - 1));
        }
    } else {
        stats.average = 0;
        stats.stddev = 0;
    }
    return stats;
}
Also used : DataPoint(org.eclipse.test.internal.performance.data.DataPoint) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) Scalar(org.eclipse.test.internal.performance.data.Scalar)

Example 8 with DataPoint

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

the class InternalPerformanceMeter method printSample.

private void printSample(PrintStream ps, Sample sample) {
    // $NON-NLS-1$ //$NON-NLS-2$
    ps.print("Scenario '" + getScenarioName() + "' ");
    DataPoint[] dataPoints = sample.getDataPoints();
    if (dataPoints.length > 0) {
        StatisticsSession s = new StatisticsSession(dataPoints);
        Dim[] dimensions = dataPoints[0].getDimensions();
        Arrays.sort(dimensions, new DimensionComparator());
        if (dimensions.length > 0) {
            List<Dim> badDimensions = new ArrayList<>();
            long n = s.getCount(dimensions[0]);
            // $NON-NLS-1$
            MessageFormat format = new MessageFormat("({0,number,percent} in [{1}, {2}])");
            // $NON-NLS-1$
            String spaces = "                                                                                                       ";
            // $NON-NLS-1$ //$NON-NLS-2$
            ps.println("(average over " + n + " samples):");
            for (Dim dimension : dimensions) {
                double mean = s.getAverage(dimension);
                // $NON-NLS-1$ //$NON-NLS-2$
                String nameString = "  " + dimension.getName() + ":";
                String meanString = dimension.getDisplayValue(mean);
                int align = firstNonDigit(meanString);
                int endIndex = 30 - align - nameString.length();
                if (endIndex > 0)
                    meanString = spaces.substring(0, endIndex) + meanString;
                align = nameString.length() + meanString.length();
                Percentile percentile = StatisticsUtil.T95;
                double[] confidenceInterval = s.getConfidenceInterval(dimension, percentile);
                StringBuffer printBuffer;
                if (n <= 2) {
                    // $NON-NLS-1$
                    printBuffer = new StringBuffer(" (no confidence)");
                } else {
                    printBuffer = new StringBuffer();
                    int ns = align;
                    while (ns++ < 40) printBuffer.append(' ');
                    printBuffer.append(format.format(new Object[] { Double.valueOf(percentile.inside()), dimension.getDisplayValue(confidenceInterval[0]), dimension.getDisplayValue(confidenceInterval[1]) }));
                }
                align += printBuffer.length();
                try {
                    while (align++ < 70) printBuffer.append(' ');
                    printBuffer.append(checkSampleSize(s, sample, dimension));
                } catch (CoreException x) {
                    badDimensions.add(dimension);
                    continue;
                }
                ps.print(nameString);
                ps.print(meanString);
                ps.println(printBuffer);
            }
            if (!badDimensions.isEmpty()) {
                // $NON-NLS-1$
                ps.print("  Dimensions with unusable statistical properties: ");
                for (Iterator<Dim> iter = badDimensions.iterator(); iter.hasNext(); ) {
                    Dim dimension = iter.next();
                    ps.print(dimension.getName());
                    if (iter.hasNext())
                        // $NON-NLS-1$
                        ps.print(", ");
                }
                ps.println();
            }
        }
    }
    ps.println();
}
Also used : Percentile(org.eclipse.test.internal.performance.eval.StatisticsUtil.Percentile) MessageFormat(java.text.MessageFormat) ArrayList(java.util.ArrayList) Dim(org.eclipse.test.internal.performance.data.Dim) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) StatisticsSession(org.eclipse.test.internal.performance.eval.StatisticsSession) CoreException(org.eclipse.core.runtime.CoreException) DataPoint(org.eclipse.test.internal.performance.data.DataPoint)

Example 9 with DataPoint

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

the class OSPerformanceMeter method getSample.

@Override
public Sample getSample() {
    if (fDataPoints != null) {
        HashMap runProperties = new HashMap();
        collectRunInfo(runProperties);
        return new Sample(getScenarioName(), fStartTime, runProperties, fDataPoints.toArray(new DataPoint[fDataPoints.size()]));
    }
    return null;
}
Also used : HashMap(java.util.HashMap) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) Sample(org.eclipse.test.internal.performance.data.Sample)

Example 10 with DataPoint

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

the class SystemTimePerformanceMeter method getSample.

@Override
public Sample getSample() {
    Assert.isTrue(fStartTime.size() == fStopTime.size());
    Map properties = new HashMap();
    /*
         * properties.put(DRIVER_PROPERTY, PerformanceTestPlugin.getBuildId()); properties.put(HOSTNAME_PROPERTY, getHostName());
         */
    DataPoint[] data = new DataPoint[2 * fStartTime.size()];
    for (int i = 0; i < fStartTime.size(); i++) {
        data[2 * i] = createDataPoint(BEFORE, InternalDimensions.SYSTEM_TIME, fStartTime.get(i).longValue());
        data[2 * i + 1] = createDataPoint(AFTER, InternalDimensions.SYSTEM_TIME, fStopTime.get(i).longValue());
    }
    return new Sample(getScenarioName(), fStartDate, properties, data);
}
Also used : HashMap(java.util.HashMap) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) Sample(org.eclipse.test.internal.performance.data.Sample) Map(java.util.Map) HashMap(java.util.HashMap) DataPoint(org.eclipse.test.internal.performance.data.DataPoint)

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