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);
}
}
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();
}
}
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);
}
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();
}
}
Aggregations