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

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

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

StopWatch.suspend介绍

[英]Suspend the stopwatch for later resumption.

This method suspends the watch until it is resumed. The watch will not include time between the suspend and resume calls in the total time.
[中]暂停秒表,以便稍后恢复。
此方法暂停手表,直到它恢复。手表将不包括暂停和恢复通话之间的总时间。

代码示例

代码示例来源:origin: NationalSecurityAgency/datawave

public void initializeTimers() {
  timers.get(TIMERS.HASNEXT).start();
  timers.get(TIMERS.HASNEXT).suspend();
  
  timers.get(TIMERS.SCANNER_ITERATE).start();
  timers.get(TIMERS.SCANNER_ITERATE).suspend();
  
  timers.get(TIMERS.SCANNER_START).start();
  timers.get(TIMERS.SCANNER_START).suspend();
}

代码示例来源:origin: NationalSecurityAgency/datawave

/**
 * Place all timers in a suspended state.
 */
protected void initializeTimers() {
  stats.getTimer(TIMERS.HASNEXT).start();
  stats.getTimer(TIMERS.HASNEXT).suspend();
  
  stats.getTimer(TIMERS.SCANNER_ITERATE).start();
  stats.getTimer(TIMERS.SCANNER_ITERATE).suspend();
  
  stats.getTimer(TIMERS.SCANNER_START).start();
  stats.getTimer(TIMERS.SCANNER_START).suspend();
  
}

代码示例来源:origin: org.zaproxy/zap

public void start(StructuralNode node) {
  if (stopWatchStarted) {
    stopWatch.resume();
  } else {
    stopWatch.start();
    stopWatchStarted = true;
  }
  try {
    inOrderAnalyse(node);
  } finally {
    stopWatch.suspend();
  }
}

代码示例来源:origin: de.tudarmstadt.ukp.dkpro.teaching/de.tudarmstadt.ukp.dkpro.teaching.frequency

public static void main(String[] args) throws Exception
  {
    Web1TProvider web1t = new Web1TProvider(new Locale("de"), 1);
    BrownCorpus brown = new BrownCorpus();
    
    StopWatch watch = new StopWatch();
    watch.start();
    watch.suspend();

    for (Text text : brown.getTexts()) {
      for (Sentence s : text.getSentences()) {
        for (String t : s.getTokens()) {
          watch.resume();
          web1t.getFrequency(t);
          watch.suspend();
        }
      }
    }
    
    double time = (double) watch.getTime() / 1000;
    System.out.println(time + "s");
  }
}

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

StopWatch stopWatch = new StopWatch();
stopWatch.start();
...
stopWatch.suspend();
...
stopWatch.resume();
...
stopWatch.stop():

long elapsed = stopWatch.getTime();

代码示例来源:origin: NationalSecurityAgency/datawave

if (null != stats) {
  stats.incrementKeysSeen(retrievalCount);
  stats.getTimer(TIMERS.SCANNER_ITERATE).suspend();
stats.getTimer(TIMERS.SCANNER_START).suspend();

代码示例来源:origin: NationalSecurityAgency/datawave

log.trace("Leaving");
  if (null != myStats)
    myStats.getTimer(TIMERS.SCANNER_START).suspend();
  return this;
myStats.getTimer(TIMERS.SCANNER_START).suspend();
myStats.getTimer(TIMERS.SCANNER_ITERATE).suspend();

代码示例来源:origin: NationalSecurityAgency/datawave

if (null != stats) {
  stats.incrementKeysSeen(retrievalCount);
  stats.getTimer(TIMERS.SCANNER_ITERATE).suspend();
stats.getTimer(TIMERS.SCANNER_START).suspend();

代码示例来源:origin: NationalSecurityAgency/datawave

if (null != stats) {
  try {
    stats.getTimer(TIMERS.HASNEXT).suspend();
  } catch (Exception e) {
    log.error(e);

代码示例来源:origin: NationalSecurityAgency/datawave

if (null != stats) {
  try {
    stats.getTimer(TIMERS.HASNEXT).suspend();
  } catch (Exception e) {
    log.error("Failed to suspend timer", e);

相关文章