/** * Return a string representation of the elapsed time by calling <code>getTimeDiffString()</code>. */ @Override public String toString() { return getTimeDiffString(); }
public void trace(String label) { if (Debug.isEnabled()) { Debug.trace(label + ": " + getTimeDiffString()); } } }
/** * Tests the functionality of getTimeDiffString() */ public void testGetTimeDiffString() { StopWatch watch = new StopWatch(); watch.stop(); // just check that we don't get an empty string assertTrue("" != watch.getTimeDiffString()); }
/** * Tests the functionality of toString() */ public void testToString() { StopWatch watch = new StopWatch(); try { Thread.sleep(10); } catch (InterruptedException e) { } watch.stop(); assertEquals(watch.getTimeDiffString(), watch.toString()); } }
final String label = String.format("Processed slice %d of %d : ", idx + 1, sliceRectangles.length); stopWatch.stop(); logger.info(label + stopWatch.getTimeDiffString());