コード例 #1
0
  private void runOnce(final GradleSession session, MeasuredOperationList results) {
    final Runnable runner = session.runner();

    MeasuredOperation operation =
        timer.measure(
            new Action<MeasuredOperation>() {
              @Override
              public void execute(MeasuredOperation measuredOperation) {
                runner.run();
              }
            });

    if (operation.getException() == null) {
      dataCollector.collect(session.getInvocation().getWorkingDirectory(), operation);
    }

    results.add(operation);
  }
コード例 #2
0
 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.setBigDecimal(
         4, operation.getConfigurationTime().toUnits(Duration.MILLI_SECONDS).getValue());
     statement.setBigDecimal(
         5, operation.getExecutionTime().toUnits(Duration.MILLI_SECONDS).getValue());
     statement.setBigDecimal(
         6, operation.getTotalMemoryUsed().toUnits(DataAmount.BYTES).getValue());
     statement.setBigDecimal(
         7, operation.getTotalHeapUsage().toUnits(DataAmount.BYTES).getValue());
     statement.setBigDecimal(8, operation.getMaxHeapUsage().toUnits(DataAmount.BYTES).getValue());
     statement.setBigDecimal(
         9, operation.getMaxUncollectedHeap().toUnits(DataAmount.BYTES).getValue());
     statement.setBigDecimal(
         10, operation.getMaxCommittedHeap().toUnits(DataAmount.BYTES).getValue());
     statement.execute();
   }
 }