Search in sources :

Example 1 with MeasuredOperation

use of org.gradle.performance.measure.MeasuredOperation in project gradle by gradle.

the class BuildExperimentRunner method runOnce.

protected void runOnce(final InvocationExecutorProvider session, final MeasuredOperationList results, final BuildExperimentInvocationInfo invocationInfo) {
    BuildExperimentSpec experiment = invocationInfo.getBuildExperimentSpec();
    final Action<MeasuredOperation> runner = session.runner(invocationInfo, wrapInvocationCustomizer(invocationInfo, createInvocationCustomizer(invocationInfo)));
    if (experiment.getListener() != null) {
        experiment.getListener().beforeInvocation(invocationInfo);
    }
    MeasuredOperation operation = new MeasuredOperation();
    try {
        runner.execute(operation);
    } catch (Exception e) {
        operation.setException(e);
    }
    final AtomicBoolean omitMeasurement = new AtomicBoolean();
    if (experiment.getListener() != null) {
        experiment.getListener().afterInvocation(invocationInfo, operation, new BuildExperimentListener.MeasurementCallback() {

            @Override
            public void omitMeasurement() {
                omitMeasurement.set(true);
            }
        });
    }
    if (!omitMeasurement.get()) {
        if (operation.isValid()) {
            dataCollector.collect(invocationInfo, operation);
        }
        results.add(operation);
    }
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) MeasuredOperation(org.gradle.performance.measure.MeasuredOperation)

Example 2 with MeasuredOperation

use of org.gradle.performance.measure.MeasuredOperation in project gradle by gradle.

the class BaseCrossBuildResultsStore method addOperations.

private void addOperations(PreparedStatement statement, long executionId, BuildDisplayInfo displayInfo, MeasuredOperationList operations) throws SQLException {
    for (MeasuredOperation operation : operations) {
        statement.setLong(1, executionId);
        statement.setString(2, displayInfo.getProjectName());
        statement.setString(3, displayInfo.getDisplayName());
        statement.setObject(4, toArray(displayInfo.getTasksToRun()));
        statement.setObject(5, toArray(displayInfo.getArgs()));
        statement.setObject(6, toArray(displayInfo.getGradleOpts()));
        statement.setObject(7, displayInfo.getDaemon());
        statement.setBigDecimal(8, operation.getTotalTime().toUnits(Duration.MILLI_SECONDS).getValue());
        statement.addBatch();
    }
}
Also used : MeasuredOperation(org.gradle.performance.measure.MeasuredOperation)

Example 3 with MeasuredOperation

use of org.gradle.performance.measure.MeasuredOperation in project gradle by gradle.

the class GradleVsMavenBuildExperimentRunner method runMavenExperiment.

private void runMavenExperiment(MeasuredOperationList results, MavenBuildExperimentSpec experiment, final MavenInvocationSpec buildSpec) {
    File projectDir = buildSpec.getWorkingDirectory();
    performMeasurements(new InvocationExecutorProvider() {

        public Action<MeasuredOperation> runner(final BuildExperimentInvocationInfo invocationInfo, final InvocationCustomizer invocationCustomizer) {
            return new Action<MeasuredOperation>() {

                @Override
                public void execute(MeasuredOperation measuredOperation) {
                    final ExecAction mavenInvocation = createMavenInvocation(invocationCustomizer.customize(invocationInfo, buildSpec));
                    System.out.println("Run Maven using JVM opts: " + Iterables.concat(buildSpec.getMavenOpts(), buildSpec.getJvmOpts()));
                    DurationMeasurementImpl.measure(measuredOperation, new Runnable() {

                        @Override
                        public void run() {
                            mavenInvocation.execute();
                        }
                    });
                }
            };
        }
    }, experiment, results, projectDir);
}
Also used : Action(org.gradle.api.Action) ExecAction(org.gradle.process.internal.ExecAction) ExecAction(org.gradle.process.internal.ExecAction) File(java.io.File) MeasuredOperation(org.gradle.performance.measure.MeasuredOperation)

Example 4 with MeasuredOperation

use of org.gradle.performance.measure.MeasuredOperation in project gradle by gradle.

the class CrossVersionResultsStore method addOperations.

private void addOperations(PreparedStatement statement, long testId, String version, MeasuredOperationList operations) throws SQLException {
    for (MeasuredOperation operation : operations) {
        statement.setLong(1, testId);
        statement.setString(2, version);
        statement.setBigDecimal(3, operation.getTotalTime().toUnits(Duration.MILLI_SECONDS).getValue());
        statement.addBatch();
    }
}
Also used : MeasuredOperation(org.gradle.performance.measure.MeasuredOperation)

Aggregations

MeasuredOperation (org.gradle.performance.measure.MeasuredOperation)4 File (java.io.File)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 Action (org.gradle.api.Action)1 ExecAction (org.gradle.process.internal.ExecAction)1