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

x33g5p2x  于2022-01-29 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(125)

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

StopWatch.getSplitTime介绍

[英]Get the split time on the stopwatch.

This is the time between start and latest split.
[中]在秒表上记下分时。
这是从开始到最后一次拆分之间的时间。

代码示例

代码示例来源:origin: org.apache.commons/commons-lang3

/**
 * <p>
 * Gets a summary of the split time that the stopwatch recorded as a string.
 * </p>
 *
 * <p>
 * The format used is ISO 8601-like, <i>hours</i>:<i>minutes</i>:<i>seconds</i>.<i>milliseconds</i>.
 * </p>
 *
 * @return the split time as a String
 * @since 2.1
 */
public String toSplitString() {
  return DurationFormatUtils.formatDurationHMS(getSplitTime());
}

代码示例来源:origin: org.apache.commons/commons-lang3

@Test
public void testStopWatchSplit() {
  final StopWatch watch = new StopWatch();
  watch.start();
  try {
    Thread.sleep(550);
  } catch (final InterruptedException ex) {
  }
  watch.split();
  final long splitTime = watch.getSplitTime();
  final String splitStr = watch.toSplitString();
  try {
    Thread.sleep(550);
  } catch (final InterruptedException ex) {
  }
  watch.unsplit();
  try {
    Thread.sleep(550);
  } catch (final InterruptedException ex) {
  }
  watch.stop();
  final long totalTime = watch.getTime();
  assertEquals("Formatted split string not the correct length",
      splitStr.length(), 12);
  assertTrue(splitTime >= 500);
  assertTrue(splitTime < 700);
  assertTrue(totalTime >= 1500);
  assertTrue(totalTime < 1900);
}

代码示例来源:origin: org.apache.commons/commons-lang3

watch.getSplitTime();
  fail("Calling getSplitTime on an unsplit StopWatch should throw an exception. ");
} catch (final IllegalStateException ise) {

代码示例来源:origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <p>
 * Gets a summary of the split time that the stopwatch recorded as a string.
 * </p>
 *
 * <p>
 * The format used is ISO 8601-like, <i>hours</i>:<i>minutes</i>:<i>seconds</i>.<i>milliseconds</i>.
 * </p>
 *
 * @return the split time as a String
 * @since 2.1
 */
public String toSplitString() {
  return DurationFormatUtils.formatDurationHMS(getSplitTime());
}

代码示例来源:origin: io.virtdata/virtdata-lib-curves4

/**
 * <p>
 * Gets a summary of the split time that the stopwatch recorded as a string.
 * </p>
 *
 * <p>
 * The format used is ISO 8601-like, <i>hours</i>:<i>minutes</i>:<i>seconds</i>.<i>milliseconds</i>.
 * </p>
 *
 * @return the split time as a String
 * @since 2.1
 */
public String toSplitString() {
  return DurationFormatUtils.formatDurationHMS(getSplitTime());
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * <p>
 * Gets a summary of the split time that the stopwatch recorded as a string.
 * </p>
 *
 * <p>
 * The format used is ISO 8601-like, <i>hours</i>:<i>minutes</i>:<i>seconds</i>.<i>milliseconds</i>.
 * </p>
 *
 * @return the split time as a String
 * @since 2.1
 */
public String toSplitString() {
  return DurationFormatUtils.formatDurationHMS(getSplitTime());
}

代码示例来源:origin: dhis2/dhis2-core

/**
 * Yields the elapsed time since the Clock was started as an HMS String.
 * @return the elapsed time.
 */
public String time()
{
  super.split();
  
  return DurationFormatUtils.formatDurationHMS( super.getSplitTime() );
}

代码示例来源:origin: dhis2/dhis2-core

/**
   * Timestamps the given message using the elapsed time of this Clock and
   * logs it using the logger.
   * @param message the message to log.
   * @return this Clock.
   */
  public Clock logTime( String message )
  {
    super.split();
    
    String time = DurationFormatUtils.formatDurationHMS( super.getSplitTime() ); 
    
    String msg = message + SEPARATOR + time;
    
    if ( log != null )
    {
      log.info( msg );
    }
    else
    {
      defaultLog.info( msg );
    }
    
    return this;
  }
}

代码示例来源:origin: org.genesys-pgr/genesys-geotools

long processingTime = stopWatch.getSplitTime();
if (debug) {
  LOG.debug("Processing time split: " + processingTime);

代码示例来源:origin: com.atlassian.jira/jira-core

log.info("" + backgroundIndexListener.getTotalModifications() + " concurrently modified issues reindexed in " + (watch.getTime() - watch.getSplitTime()) + " millis.");
watch.split();

相关文章