/** * obtain miss count for a specific key * * @param key * timer key * @return hit count for a specific key */ public long getMissCount(String key) { TimeStats last = EVENT_MAP.get(key); return last != null ? last.getMissCount() : 0; }
/** * 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(); }
@Override public DumpCollection getDump() { Dump dump = new Dump(getCategoryName() + "-Table", this); for (Entry<String, TimeStats> entry : timeTracker.getTimeStats().entrySet()) { dump.add( entry.getKey(), "h(" + entry.getValue().getHitCount() + "-" + entry.getValue().getHitAge(TimeUnit.MILLISECONDS) + ")" + "m(" + entry.getValue().getMissCount() + "-" + entry.getValue().getMissAge(TimeUnit.MILLISECONDS) + ")"); } return dump; } }