Search in sources :

Example 1 with InternalPerformanceMeter

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

the class Performance method tagAsGlobalSummary.

/**
 * Mark the scenario represented by the given PerformanceMeter to be included into the global and the component performance
 * summary. The summary shows the given dimensions of the scenario and labels the scenario with the short name.
 *
 * @param pm
 *            the PerformanceMeter
 * @param shortName
 *            a short (shorter than 40 characters) descriptive name of the scenario
 * @param dimensions
 *            an array of dimensions to show in the summary
 */
public void tagAsGlobalSummary(PerformanceMeter pm, String shortName, Dimension[] dimensions) {
    if (pm instanceof InternalPerformanceMeter) {
        InternalPerformanceMeter ipm = (InternalPerformanceMeter) pm;
        ipm.tagAsSummary(true, shortName, dimensions);
    }
}
Also used : InternalPerformanceMeter(org.eclipse.test.internal.performance.InternalPerformanceMeter)

Example 2 with InternalPerformanceMeter

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

the class Performance method setComment.

/**
 * Set a comment for the scenario represented by the given PerformanceMeter. Currently only comments with a commentKind of
 * EXPLAINS_DEGRADATION_COMMENT are used. Their commentText is shown in a hover of the performance summaries graph if a
 * performance degradation exists.
 *
 * @param pm
 *            the PerformanceMeter
 * @param commentKind
 *            kind of comment. Must be EXPLAINS_DEGRADATION_COMMENT to have an effect.
 * @param commentText
 *            the comment (shorter than 400 characters)
 */
public void setComment(PerformanceMeter pm, int commentKind, String commentText) {
    if (commentKind == EXPLAINS_DEGRADATION_COMMENT) {
        if (pm instanceof InternalPerformanceMeter) {
            InternalPerformanceMeter ipm = (InternalPerformanceMeter) pm;
            ipm.setComment(commentKind, commentText);
        }
    }
}
Also used : InternalPerformanceMeter(org.eclipse.test.internal.performance.InternalPerformanceMeter)

Example 3 with InternalPerformanceMeter

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

the class Performance method tagAsSummary.

/**
 * Mark the scenario represented by the given PerformanceMeter to be included into the component performance summary. The
 * summary shows the given dimensions of the scenario and labels the scenario with the short name.
 *
 * @param pm
 *            the PerformanceMeter
 * @param shortName
 *            a short (shorter than 40 characters) descriptive name of the scenario
 * @param dimensions
 *            an array of dimensions to show in the summary
 */
public void tagAsSummary(PerformanceMeter pm, String shortName, Dimension[] dimensions) {
    if (pm instanceof InternalPerformanceMeter) {
        InternalPerformanceMeter ipm = (InternalPerformanceMeter) pm;
        ipm.tagAsSummary(false, shortName, dimensions);
    }
}
Also used : InternalPerformanceMeter(org.eclipse.test.internal.performance.InternalPerformanceMeter)

Example 4 with InternalPerformanceMeter

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

the class Evaluator method evaluate.

@Override
public void evaluate(PerformanceMeter performanceMeter) throws RuntimeException {
    if (fCheckers == null)
        // nothing to do
        return;
    // get reference build tag
    Variations refKeys = PerformanceTestPlugin.getAssertAgainst();
    String assertKey = System.getProperty(PerformanceTestPlugin.ECLIPSE_PERF_ASSERTAGAINST);
    if (refKeys == null) {
        // $NON-NLS-1$ //$NON-NLS-2$
        PerformanceTestPlugin.logWarning("refkeys was null. " + PerformanceTestPlugin.ECLIPSE_PERF_ASSERTAGAINST + " was " + assertKey);
        // nothing to do
        return;
    }
    // else
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
    PerformanceTestPlugin.logInfo("refkeys was: " + refKeys.toString() + " \n\t based on " + PerformanceTestPlugin.ECLIPSE_PERF_ASSERTAGAINST + " being set to " + assertKey);
    if (!(performanceMeter instanceof InternalPerformanceMeter))
        // we cannot handle this.
        return;
    InternalPerformanceMeter ipm = (InternalPerformanceMeter) performanceMeter;
    Sample session = ipm.getSample();
    // $NON-NLS-1$
    Assert.assertTrue("metering session is null", session != null);
    String scenarioName = session.getScenarioID();
    // determine all dimensions we need
    HashSet<Dim> allDimensions = new HashSet<>();
    for (int i = 0; i < fCheckers.length; i++) {
        AssertChecker chk = fCheckers[i];
        Dim[] dims = chk.getDimensions();
        for (int j = 0; j < dims.length; j++) allDimensions.add(dims[j]);
    }
    // get data for this session
    DataPoint[] sessionDatapoints;
    Variations config = PerformanceTestPlugin.getVariations();
    if (config != null)
        sessionDatapoints = DB.queryDataPoints(config, scenarioName, allDimensions);
    else
        sessionDatapoints = session.getDataPoints();
    if (sessionDatapoints == null || sessionDatapoints.length == 0) {
        // $NON-NLS-1$ //$NON-NLS-2$
        PerformanceTestPlugin.logWarning("no session data named '" + config + "' found");
        return;
    }
    // get reference data
    DataPoint[] datapoints = DB.queryDataPoints(refKeys, scenarioName, allDimensions);
    if (datapoints == null || datapoints.length == 0) {
        // $NON-NLS-1$ //$NON-NLS-2$
        PerformanceTestPlugin.logWarning("no reference data named '" + refKeys + "' found");
        return;
    }
    // calculate the average
    StatisticsSession referenceStats = new StatisticsSession(datapoints);
    StatisticsSession measuredStats = new StatisticsSession(sessionDatapoints);
    // $NON-NLS-1$ //$NON-NLS-2$
    StringBuffer failMesg = new StringBuffer("Performance criteria not met when compared to '" + refKeys + "':");
    boolean pass = true;
    for (int i = 0; i < fCheckers.length; i++) {
        AssertChecker chk = fCheckers[i];
        pass &= chk.test(referenceStats, measuredStats, failMesg);
    }
    if (!pass) {
        if (config != null)
            DB.markAsFailed(config, session, failMesg.toString());
    // else
    // Assert.assertTrue(failMesg.toString(), false);
    }
}
Also used : Sample(org.eclipse.test.internal.performance.data.Sample) Variations(org.eclipse.test.internal.performance.db.Variations) Dim(org.eclipse.test.internal.performance.data.Dim) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) InternalPerformanceMeter(org.eclipse.test.internal.performance.InternalPerformanceMeter) HashSet(java.util.HashSet)

Aggregations

InternalPerformanceMeter (org.eclipse.test.internal.performance.InternalPerformanceMeter)4 HashSet (java.util.HashSet)1 DataPoint (org.eclipse.test.internal.performance.data.DataPoint)1 Dim (org.eclipse.test.internal.performance.data.Dim)1 Sample (org.eclipse.test.internal.performance.data.Sample)1 Variations (org.eclipse.test.internal.performance.db.Variations)1