org.apache.commons.lang.time.StopWatch.reset()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中org.apache.commons.lang.time.StopWatch.reset()方法的一些代码示例,展示了StopWatch.reset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StopWatch.reset()方法的具体详情如下:
包路径:org.apache.commons.lang.time.StopWatch
类名称:StopWatch
方法名:reset

StopWatch.reset介绍

[英]Resets the stopwatch. Stops it if need be.

This method clears the internal values to allow the object to be reused.
[中]重置秒表。必要时停止。
此方法清除内部值以允许重用对象。

代码示例

代码示例来源:origin: omero/blitz

/**
 * @see TimeEstimator#start()
 */
public void start() {
  final StopWatch sw = swGetter.get();
  sw.reset();
  sw.start();
}

代码示例来源:origin: jhpoelen/eol-globi-data

public void start() {
  stopWatch.reset();
  counter.set(0);
  stopWatch.start();
}

代码示例来源:origin: david-schuler/javalanche

public void setTest(String testName) {
  testStopWatch.reset();
  testStopWatch.start();
  currentTest = testName;
}

代码示例来源:origin: david-schuler/javalanche

public void addMutation(Mutation mutation) {
  mutationStopWatch.reset();
  mutationStopWatch.start();
  currentMutation = mutation;
  mutations.add(mutation.getId());
}

代码示例来源:origin: stackoverflow.com

private void lapWatchAndLog( StopWatch watch, String messageForLap ) {

  watch.stop();
  LOGGER.info( String.format( "Time: [%s] %s", watch.getTime(), messageForLap ) );
  watch.reset();
  watch.start();
}

代码示例来源:origin: org.apache.archiva.redback/redback-rest-services

stopWatch.reset();
stopWatch.start();

代码示例来源:origin: jwplayer/southpaw

@Override
public long getLag() {
  // Periodically cache the end offset
  if(endOffset == null || endOffsetWatch.getTime() > END_OFFSET_REFRESH_MS_DEFAULT) {
    Map<TopicPartition, Long> offsets = consumer.endOffsets(Collections.singletonList(new TopicPartition(topicName, 0)));
    endOffset = offsets.get(new TopicPartition(topicName, 0));
    endOffsetWatch.reset();
    endOffsetWatch.start();
  }
  // Because the end offset is only updated periodically, it's possible to see negative lag. Send 0 instead.
  long lag = endOffset - (getCurrentOffset() == null ? 0 : getCurrentOffset());
  return lag < 0 ? 0 : lag;
}

代码示例来源:origin: org.apache.archiva/archiva-web-common

stopWatch.reset();
stopWatch.start();

代码示例来源:origin: apache/archiva

stopWatch.reset();
stopWatch.start();

代码示例来源:origin: stackoverflow.com

stopWatch.reset();
monitorObj.notify();

代码示例来源:origin: david-schuler/javalanche

public static void deleteResults(Session session, Query q) {
  @SuppressWarnings("unchecked")
  List<Mutation> mutations = q.list();
  int deletes = 0, flushs = 0;
  StopWatch stp = new StopWatch();
  for (Mutation m : mutations) {
    MutationTestResult result = m.getMutationResult();
    if (result != null) {
      m.setMutationResult(null);
      session.delete(result);
      deletes++;
    }
    if (deletes > 20) {
      // 20, same as the JDBC batch size
      // flush a batch of inserts and release memory:
      // see
      // http://www.hibernate.org/hib_docs/reference/en/html/batch.html
      stp.reset();
      stp.start();
      flushs++;
      session.flush();
      // session.clear();
      logger.info("Did flush. It took: "
          + DurationFormatUtils.formatDurationHMS(stp.getTime()));
      deletes = 0;
    }
  }
  logger.info(String.format("Deleted %d mutation results",
      mutations.size()));
}

代码示例来源:origin: david-schuler/javalanche

/**
 * Turns the current mutation on.
 */
public void switchOn() {
  if (currentMutation != null) {
    logger.info("enabling mutation: "
        + currentMutation.getMutationVariable() + " in line "
        + currentMutation.getLineNumber() + " - "
        + currentMutation.toString());
    stopWatch.reset();
    stopWatch.start();
    System.setProperty(currentMutation.getMutationVariable(), "1");
    System.setProperty(CURRENT_MUTATION_KEY,
        currentMutation.getId() + "");
  }
}

代码示例来源:origin: jaibeermalik/searchanalytics-bigdata

private void returnAllIndicesCurrentStateAndReset() {
  LOG.debug("Master Actor message received for DONE check, status is:"
      + allIndexingDone);
  getSender().tell(allIndexingDone, getSelf());
  // Reset current state
  if (allIndexingDone) {
    LOG.debug("Indexing setup finished for all indices!");
    allIndexingDone = false;
    indexDone.clear();
    // Setting it here, but need to check that it will never be called,
    // if client dies.
    // put additional check when you receive new rebuild call, 1 min
    // check
    isRebuildInProgress = false;
    stopWatch.reset();
    // TODO as it is single instance, need not to stop it.
    // getContext().stop(getSelf());
    // TODO: check when the alising should be changed.
  }
}

代码示例来源:origin: jaibeermalik/searchanalytics-bigdata

private void handleIndexingRebuildMessage(final Object message) {
  // Start watch first time.
  if (!isRebuildInProgress) {
    stopWatch.start();
  }
  // need to validate the hanging state here
  // All indexing done, but rebuild in progress. wait 5 min for client
  // otherwise reset state.
  if (allIndexingDone && isRebuildInProgress) {
    if (stopWatch.getTime() > 5 * 60 * 1000) {
      isRebuildInProgress = false;
      stopWatch.reset();
    }
  }
  if (isRebuildInProgress) {
    LOG.error(
        "Rebuilding is already in progress, ignoring another rebuild message: {}",
        message);
  } else {
    isRebuildInProgress = true;
    setupIndicesForAll();
  }
}

代码示例来源:origin: david-schuler/javalanche

stp.reset();
stp.start();
flushs++;

代码示例来源:origin: apache/eagle

public void sendDESCOrderedEventsToWindow(StreamWindow window, StreamWindowRepository.StorageType storageType, int num) {
  LOGGER.info("Sending {} events to {} ({})", num, window.getClass().getSimpleName(), storageType);
  StopWatch stopWatch = new StopWatch();
  stopWatch.start();
  int i = 0;
  while (i < num) {
    PartitionedEvent event = MockSampleMetadataFactory.createPartitionedEventGroupedByName("sampleStream_1", (window.startTime() + i));
    window.add(event);
    i++;
  }
  stopWatch.stop();
  performanceReport.put(num + "\tInsertTime\t" + storageType, stopWatch.getTime());
  LOGGER.info("Inserted {} events in {} ms", num, stopWatch.getTime());
  stopWatch.reset();
  stopWatch.start();
  window.flush();
  stopWatch.stop();
  performanceReport.put(num + "\tReadTime\t" + storageType, stopWatch.getTime());
}

代码示例来源:origin: jhpoelen/eol-globi-data

LOG.info("walked [" + batchSize + "] interactions in " + getProgressMsg(batchSize, duration));
watchForBatch.reset();
watchForBatch.start();

代码示例来源:origin: jenkinsci/gerrit-trigger-plugin

watch.reset();
watch.start();
while (gerritServer.getGerritProjects().size() == 0) {

代码示例来源:origin: jhpoelen/eol-globi-data

LOG.info("resolved batch of [" + batchSize + "] names in " + getProgressMsg(batchSize, duration));
watchForBatch.reset();
watchForBatch.start();

代码示例来源:origin: visallo/vertexium

assertFalse(graph2.getPropertyDefinition("p1").isSortable());
timeout.reset();
timeout.start();
while (timeout.getTime() < 5000) {

相关文章