Search in sources :

Example 1 with MeasuredOperationList

use of org.gradle.performance.results.MeasuredOperationList in project gradle by gradle.

the class BuildExperimentRunner method doWarmup.

private void doWarmup(BuildExperimentSpec experiment, File projectDir, InvocationExecutorProvider session) {
    int warmUpCount = warmupsForExperiment(experiment);
    for (int i = 0; i < warmUpCount; i++) {
        System.out.println();
        System.out.println(String.format("Warm-up #%s", i + 1));
        BuildExperimentInvocationInfo info = new DefaultBuildExperimentInvocationInfo(experiment, projectDir, Phase.WARMUP, i + 1, warmUpCount);
        runOnce(session, new MeasuredOperationList(), info);
    }
}
Also used : MeasuredOperationList(org.gradle.performance.results.MeasuredOperationList)

Example 2 with MeasuredOperationList

use of org.gradle.performance.results.MeasuredOperationList in project gradle by gradle.

the class GradleVsMavenBuildExperimentRunner method runMavenExperiment.

private void runMavenExperiment(MeasuredOperationList results, final 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) {
                    System.out.println("Run Maven using JVM opts: " + Iterables.concat(buildSpec.getMavenOpts(), buildSpec.getJvmOpts()));
                    List<String> cleanTasks = buildSpec.getCleanTasks();
                    if (!cleanTasks.isEmpty()) {
                        System.out.println("Cleaning up by running Maven tasks: " + Joiner.on(" ").join(buildSpec.getCleanTasks()));
                        ExecAction clean = createMavenInvocation(buildSpec, cleanTasks);
                        executeWithFileLogging(experiment, clean);
                    }
                    MavenInvocationSpec invocation = invocationCustomizer.customize(invocationInfo, buildSpec);
                    final ExecAction run = createMavenInvocation(invocation, invocation.getTasksToRun());
                    System.out.println("Measuring Maven tasks: " + Joiner.on(" ").join(buildSpec.getTasksToRun()));
                    DurationMeasurementImpl.measure(measuredOperation, new Runnable() {

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

Aggregations

MeasuredOperationList (org.gradle.performance.results.MeasuredOperationList)2 File (java.io.File)1 List (java.util.List)1 Action (org.gradle.api.Action)1 MeasuredOperation (org.gradle.performance.measure.MeasuredOperation)1 ExecAction (org.gradle.process.internal.ExecAction)1