/** * <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()); }
@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); }
watch.getSplitTime(); fail("Calling getSplitTime on an unsplit StopWatch should throw an exception. "); } catch (final IllegalStateException ise) {
/** * <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()); }
/** * <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()); }
/** * <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()); }
/** * 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() ); }
/** * 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; } }
long processingTime = stopWatch.getSplitTime(); if (debug) { LOG.debug("Processing time split: " + processingTime);
log.info("" + backgroundIndexListener.getTotalModifications() + " concurrently modified issues reindexed in " + (watch.getTime() - watch.getSplitTime()) + " millis."); watch.split();