use of org.apache.jackrabbit.oak.stats.TimerStats in project jackrabbit-oak by apache.
the class MetricImplTest method timerContext.
@Test
public void timerContext() throws Exception {
VirtualClock clock = new VirtualClock();
Timer time = new Timer(new ExponentiallyDecayingReservoir(), clock);
TimerStats timerStats = new TimerImpl(time);
TimerStats.Context context = timerStats.time();
clock.tick = TimeUnit.SECONDS.toNanos(314);
context.close();
assertEquals(1, time.getCount());
assertEquals(TimeUnit.SECONDS.toNanos(314), time.getSnapshot().getMax());
}
use of org.apache.jackrabbit.oak.stats.TimerStats in project jackrabbit-oak by apache.
the class MetricStatisticsProviderTest method timer.
@Test
public void timer() throws Exception {
TimerStats timerStats = statsProvider.getTimer("test", StatsOptions.DEFAULT);
assertNotNull(timerStats);
assertNotNull(statsProvider.getRegistry().getTimers().containsKey("test"));
assertTrue(((CompositeStats) timerStats).isTimer());
}
Aggregations