/** * Miss this entry, time stamp it and count the number of miss * * @return elapsed nanoseconds since the last miss */ public long miss() { return miss(+1); }
/** * Miss and obtain elapsed nanoseconds since last miss based. Time statistics is maintained per thread. * * @return elapsed nanoseconds since last miss */ public static long missAndGet() { return THREAD_TIMER.get().miss(); }
/** * Miss and obtain elapsed nanoseconds since last miss * * @param key * timer key * @return elapsed nanoseconds since last miss */ public long missAndGet(String key) { TimeStats timeStats = EVENT_MAP.get(key); if (timeStats == null) { timeStats = EVENT_MAP.putIfAbsent(key, new TimeStats()); timeStats = timeStats == null ? EVENT_MAP.get(key) : timeStats; } return timeStats.miss(); }
/** * Miss and obtain miss count * * @param key * timer key * @return miss count */ public long missAndGetCount(String key) { TimeStats timeStats = EVENT_MAP.get(key); if (timeStats == null) { timeStats = EVENT_MAP.putIfAbsent(key, new TimeStats()); timeStats = timeStats == null ? EVENT_MAP.get(key) : timeStats; } timeStats.miss(); return timeStats.getMissCount(); }