@Test public void testGetDurationBeforeStop() throws Exception { testStopwatch.start(); Thread.sleep(10); assertTrue(testStopwatch.getDuration() > 9000000); testStopwatch.stop(); assertTrue(testStopwatch.getDuration() > 9000000); }
@BeforeMethod public void setupTest() throws Exception { testStopwatch = new BasicStopwatch(); }
@Test public void testReset() throws Exception { testStopwatch.start(); Thread.sleep(10); testStopwatch.stop(); assertTrue(testStopwatch.getDuration() > 0); testStopwatch.reset(); assertTrue(testStopwatch.getDuration() == 0); }
@Override public void stop() { super.stop(); long duration = getDuration(TimeUnit.MILLISECONDS); sm.record(duration, TimeUnit.MILLISECONDS); }
/** * {@inheritDoc} */ @Override public long getDuration(TimeUnit timeUnit) { return timeUnit.convert(getDuration(), TimeUnit.NANOSECONDS); }
/** * {@inheritDoc} */ @Override public void stop() { super.stop(); timer.record(getDuration(), TimeUnit.NANOSECONDS); } }
/** * {@inheritDoc} */ @Override public long getDuration(TimeUnit timeUnit) { return timeUnit.convert(getDuration(), TimeUnit.NANOSECONDS); }
@Test public void testGetDuration() throws Exception { testStopwatch.start(); Thread.sleep(10); testStopwatch.stop(); assertTrue(testStopwatch.getDuration() > 9000000); }
/** * {@inheritDoc} */ @Override public void stop() { super.stop(); timer.record(getDuration(), TimeUnit.NANOSECONDS); } }
@Test public void testGetDurationWithUnit() throws Exception { testStopwatch.start(); Thread.sleep(10); testStopwatch.stop(); assertTrue(testStopwatch.getDuration() > 12); } }
@Override public void stop() { super.stop(); long duration = getDuration(TimeUnit.MILLISECONDS); sm.record(duration, TimeUnit.MILLISECONDS); }
@Override public void stop() { super.stop(); long duration = getDuration(TimeUnit.MILLISECONDS) / count; sm.record(duration); batchSize.record(count); }