Search in sources :

Example 6 with Dimension

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

the class DB method internalStore.

private boolean internalStore(final Variations variations, final Sample sample) {
    if ((fSQL == null) || (sample == null)) {
        return false;
    }
    final DataPoint[] dataPoints = sample.getDataPoints();
    final int n = dataPoints.length;
    if (n <= 0) {
        return false;
    }
    // System.out.println("store started..."); //$NON-NLS-1$
    try {
        // long l= System.currentTimeMillis();
        final int variation_id = fSQL.getVariations(variations);
        final int scenario_id = fSQL.getScenario(sample.getScenarioID());
        final String comment = sample.getComment();
        if (sample.isSummary()) {
            final boolean isGlobal = sample.isGlobal();
            int commentId = 0;
            final int commentKind = sample.getCommentType();
            if ((commentKind == Performance.EXPLAINS_DEGRADATION_COMMENT) && (comment != null)) {
                commentId = fSQL.getCommentId(commentKind, comment);
            }
            final Dimension[] summaryDimensions = sample.getSummaryDimensions();
            for (final Dimension dimension : summaryDimensions) {
                if (dimension instanceof Dim) {
                    fSQL.createSummaryEntry(variation_id, scenario_id, ((Dim) dimension).getId(), isGlobal, commentId);
                }
            }
            final String shortName = sample.getShortname();
            if (shortName != null) {
                fSQL.setScenarioShortName(scenario_id, shortName);
            }
        } else if (comment != null) {
            int commentId = 0;
            final int commentKind = sample.getCommentType();
            if (commentKind == Performance.EXPLAINS_DEGRADATION_COMMENT) {
                commentId = fSQL.getCommentId(commentKind, comment);
            }
            // use
            fSQL.createSummaryEntry(variation_id, scenario_id, 0, false, commentId);
        // special
        // dim
        // id
        // '0'
        // to
        // identify
        // summary
        // entry
        // created
        // to
        // only
        // handle
        // a
        // comment
        }
        final int sample_id = fSQL.createSample(variation_id, scenario_id, new Timestamp(sample.getStartTime()));
        if (AGGREGATE) {
            final StatisticsSession stats = new StatisticsSession(dataPoints);
            final Dim[] dims = dataPoints[0].getDimensions();
            int datapoint_id = fSQL.createDataPoint(sample_id, 0, InternalPerformanceMeter.AVERAGE);
            for (final Dim dim : dims) {
                fSQL.insertScalar(datapoint_id, dim.getId(), (long) stats.getAverage(dim));
            }
            datapoint_id = fSQL.createDataPoint(sample_id, 0, InternalPerformanceMeter.STDEV);
            for (final Dim dim : dims) {
                // see StatisticsSession
                final long value = Double.doubleToLongBits(stats.getStddev(dim));
                fSQL.insertScalar(datapoint_id, dim.getId(), value);
            }
            datapoint_id = fSQL.createDataPoint(sample_id, 0, InternalPerformanceMeter.SIZE);
            for (final Dim dim : dims) {
                fSQL.insertScalar(datapoint_id, dim.getId(), stats.getCount(dim));
            }
        } else {
            for (int i = 0; i < dataPoints.length; i++) {
                final DataPoint dp = dataPoints[i];
                final int datapoint_id = fSQL.createDataPoint(sample_id, i, dp.getStep());
                final Scalar[] scalars = dp.getScalars();
                for (final Scalar scalar : scalars) {
                    final int dim_id = scalar.getDimension().getId();
                    final long value = scalar.getMagnitude();
                    fSQL.insertScalar(datapoint_id, dim_id, value);
                }
            }
        }
        fConnection.commit();
        fStoredSamples++;
        fStoreCalled = true;
    // System.err.println(System.currentTimeMillis()-l);
    } catch (final SQLException e) {
        PerformanceTestPlugin.log(e);
        try {
            fConnection.rollback();
        } catch (final SQLException e1) {
            PerformanceTestPlugin.log(e1);
        }
    }
    return true;
}
Also used : SQLException(java.sql.SQLException) Dim(org.eclipse.test.internal.performance.data.Dim) Dimension(org.eclipse.test.performance.Dimension) Timestamp(java.sql.Timestamp) DataPoint(org.eclipse.test.internal.performance.data.DataPoint) Scalar(org.eclipse.test.internal.performance.data.Scalar) StatisticsSession(org.eclipse.test.internal.performance.eval.StatisticsSession) DataPoint(org.eclipse.test.internal.performance.data.DataPoint)

Example 7 with Dimension

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

the class PerformanceTestPlugin method getResultsDimensions.

/**
 * Returns the dimensions displayed in the performance results.
 *
 * @return The list of {@link Dimension} which will be displayed in the generated results data pages.
 */
public static Dimension[] getResultsDimensions() {
    String resultsDimension = System.getProperty(ECLIPSE_PERF_RESULTS_DIMENSIONS);
    if (resultsDimension == null)
        return DEFAULT_RESULTS_DIMENSIONS;
    // $NON-NLS-1$
    StringTokenizer tokenizer = new StringTokenizer(resultsDimension, ",");
    List<Dimension> list = new ArrayList<>();
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken().trim();
        Dimension dimension = getDimension(token);
        if (dimension == null) {
            try {
                dimension = getDimension(Integer.parseInt(token));
            } catch (NumberFormatException e) {
            // skip
            }
            if (dimension == null) {
                // $NON-NLS-1$ //$NON-NLS-2$
                System.err.println("Skip invalid results dimension found in system property '" + ECLIPSE_PERF_RESULTS_DIMENSIONS + "': " + resultsDimension);
                continue;
            }
        }
        list.add(dimension);
    }
    int size = list.size();
    if (size == 0) {
        // $NON-NLS-1$ //$NON-NLS-2$
        System.err.println("No valid dimension was found in system property '" + ECLIPSE_PERF_RESULTS_DIMENSIONS + "'!");
        // $NON-NLS-1$
        System.err.println("=> default results dimensions will be used instead!");
        return DEFAULT_RESULTS_DIMENSIONS;
    }
    Dimension[] dimensions = new Dimension[size];
    list.toArray(dimensions);
    return dimensions;
}
Also used : StringTokenizer(java.util.StringTokenizer) ArrayList(java.util.ArrayList) Dimension(org.eclipse.test.performance.Dimension)

Example 8 with Dimension

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

the class PerformanceTestPlugin method getDefaultDimension.

/**
 * Returns the default dimension used for performance results.
 *
 * @return The default {@link Dimension} or <code>null</code> if the specified default dimension does not match any known
 *         dimensions name.
 */
public static Dimension getDefaultDimension() {
    String defaultDim = System.getProperty(ECLIPSE_PERF_DEFAULT_DIM);
    if (defaultDim == null)
        return DEFAULT_DIMENSION;
    Dimension dimension = getDimension(defaultDim);
    // $NON-NLS-1$ //$NON-NLS-2$
    Assert.isNotNull(dimension, "Invalid default dimension found in system property '" + ECLIPSE_PERF_DEFAULT_DIM + "': " + defaultDim);
    return dimension;
}
Also used : Dimension(org.eclipse.test.performance.Dimension)

Example 9 with Dimension

use of org.eclipse.test.performance.Dimension in project webtools.servertools by eclipse.

the class ModuleFactoriesExtensionTestCase method testModuleFactoriesExtension.

public void testModuleFactoriesExtension() throws Exception {
    Dimension[] dims = new Dimension[] { Dimension.ELAPSED_PROCESS, Dimension.USED_JAVA_HEAP };
    tagAsGlobalSummary("Module Factories", dims);
    startMeasuring();
    ModuleFactory[] factories = ServerPlugin.getModuleFactories();
    if (factories != null) {
        for (ModuleFactory factory : factories) factory.getModules(null);
    }
    stopMeasuring();
    commitMeasurements();
    assertPerformance();
}
Also used : ModuleFactory(org.eclipse.wst.server.core.internal.ModuleFactory) Dimension(org.eclipse.test.performance.Dimension)

Aggregations

Dimension (org.eclipse.test.performance.Dimension)9 IModule (org.eclipse.wst.server.core.IModule)4 IServer (org.eclipse.wst.server.core.IServer)3 IServerWorkingCopy (org.eclipse.wst.server.core.IServerWorkingCopy)2 SQLException (java.sql.SQLException)1 Timestamp (java.sql.Timestamp)1 ArrayList (java.util.ArrayList)1 StringTokenizer (java.util.StringTokenizer)1 DataPoint (org.eclipse.test.internal.performance.data.DataPoint)1 Dim (org.eclipse.test.internal.performance.data.Dim)1 Scalar (org.eclipse.test.internal.performance.data.Scalar)1 StatisticsSession (org.eclipse.test.internal.performance.eval.StatisticsSession)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 ModuleFactory (org.eclipse.wst.server.core.internal.ModuleFactory)1 ServerEditorInput (org.eclipse.wst.server.ui.internal.editor.ServerEditorInput)1