예제 #1
0
파일: Dataset.java 프로젝트: nawroth/neode
  private void doExecute(int startIndex, BatchCommand command, long startTime) {
    log.write(
        String.format(
            "      [Beginning " + startIndex + " of " + command.numberOfIterations() + ", '%s'] %s",
            command.shortDescription(),
            elapsedTime(startTime)));

    Transaction tx = db.beginTx();
    try {
      for (int index = startIndex; indexIsInRange(startIndex, command, index); index++) {
        command.execute(db, index, random);
        tx.success();
      }
    } finally {
      tx.finish();
    }
  }
예제 #2
0
파일: Dataset.java 프로젝트: nawroth/neode
  public DomainEntityInfo execute(BatchCommand command) {
    long startTime = System.nanoTime();

    log.write(
        String.format(
            "Begin [%s Iterations: %s, BatchSize: %s]",
            command.description(), command.numberOfIterations(), command.batchSize()));
    command.onBegin(log);
    for (int index = 0; index < command.numberOfIterations(); index += command.batchSize()) {
      doExecute(index, command, startTime);
    }
    command.onEnd(log);
    log.write(String.format("End   [%s] %s\n", command.description(), elapsedTime(startTime)));

    return command.results();
  }
예제 #3
0
파일: Dataset.java 프로젝트: nawroth/neode
 private static boolean indexIsInRange(int startIndex, BatchCommand command, int index) {
   return index < (startIndex + command.batchSize()) && index < command.numberOfIterations();
 }