List of usage examples for com.google.common.cache CacheStats hitCount
long hitCount
To view the source code for com.google.common.cache CacheStats hitCount.
Click Source Link
From source file:com.google.devtools.build.lib.runtime.CacheFileDigestsModule.java
/** * Adds a line to the log with cache statistics. * * @param message message to prefix to the written line * @param stats the cache statistics to be logged *///from ww w. j a v a 2s .c o m private static void logStats(String message, CacheStats stats) { log.info(message + ": hit count=" + stats.hitCount() + ", miss count=" + stats.missCount() + ", hit rate=" + stats.hitRate() + ", eviction count=" + stats.evictionCount()); }
From source file:ca.exprofesso.guava.jcache.GuavaCacheStatisticsMXBean.java
@Override public void clear() { CacheStats cacheStats = cache.unwrap(GuavaCache.class).stats(); snapshot = new CacheStats(cacheStats.hitCount(), cacheStats.missCount(), cacheStats.loadSuccessCount(), cacheStats.loadExceptionCount(), cacheStats.totalLoadTime(), cacheStats.evictionCount()); }
From source file:com.oneops.opamp.ws.OpampWsController.java
/** * Get the current WatchedByAttributeCache status. Returns the cumulative status of * <ul>/*w w w . j av a2s . c om*/ * <li>hitCount * <li>missCount; * <li>loadSuccessCount; * <li>loadExceptionCount; * <li>totalLoadTime; * <li>evictionCount; * </ul> * * @return cache status map. */ @RequestMapping(value = "/cache/stats", method = RequestMethod.GET) @ResponseBody public Map<String, Object> getCacheStats() { Map<String, Object> stat = new LinkedHashMap<>(5); stat.put("status", "ok"); stat.put("maxSize", cache.getMaxSize()); stat.put("currentSize", cache.instance().size()); stat.put("timeout", cache.getTimeout()); CacheStats cs = cache.instance().stats(); stat.put("hitCount", cs.hitCount()); stat.put("missCount", cs.missCount()); stat.put("loadSuccessCount", cs.loadSuccessCount()); stat.put("totalLoadTime", TimeUnit.SECONDS.convert(cs.totalLoadTime(), TimeUnit.NANOSECONDS)); stat.put("loadExceptionCount", cs.loadExceptionCount()); stat.put("evictionCount", cs.evictionCount()); return stat; }
From source file:uk.ac.ed.inf.ace.utils.InstrumentedCache.java
private void emitStats() { int thisRequestCount = requestCount.getAndIncrement(); if (thisRequestCount > 0 && thisRequestCount % REQUEST_COUNT_EMIT_GAP == 0) { CacheStats stats = cache.stats(); LOGGER.log(Level.INFO, "{0} stats (C-H-M-E-S-F): {1} - {2} - {3} - {4} - {5} - {6}", new Object[] { name, thisRequestCount, stats.hitCount(), stats.missCount(), stats.evictionCount(), stats.loadSuccessCount(), stats.loadExceptionCount() }); }// w ww. j a v a2 s . c o m }
From source file:com.facebook.buck.rules.keys.EventPostingRuleKeyCacheScope.java
@Override public final void close() { try (SimplePerfEvent.Scope scope = SimplePerfEvent.scope(buckEventBus, PerfEventId.of("rule_key_cache_cleanup"))) { // Log stats. CacheStats stats = cache.getStats().minus(startStats); buckEventBus.post(RuleKeyCacheStatsEvent.create(stats)); scope.update("hitRate", stats.hitRate()); scope.update("hits", stats.hitCount()); scope.update("misses", stats.missCount()); scope.update("requests", stats.requestCount()); scope.update("load_time_ns", stats.totalLoadTime()); // Run additional cleanup. cleanup(scope);//ww w. j av a2s .co m } }
From source file:com.oneops.antenna.ws.AntennaWsController.java
/** * Get the current sink cache status. Returns the cumulative status of * <ul>/*from w ww. j a va 2 s . c o m*/ * <li>hitCount * <li>missCount; * <li>loadSuccessCount; * <li>loadExceptionCount; * <li>totalLoadTime; * <li>evictionCount; * </ul> * * @return cache status map. */ @RequestMapping(value = "/cache/stats", method = GET) @ResponseBody public Map<String, Object> getCacheStats() { Map<String, Object> stat = new LinkedHashMap<>(5); stat.put("status", "ok"); stat.put("maxSize", cache.getMaxSize()); stat.put("currentSize", cache.instance().size()); stat.put("timeout", cache.getTimeout()); CacheStats cs = cache.instance().stats(); stat.put("hitCount", cs.hitCount()); stat.put("missCount", cs.missCount()); stat.put("loadSuccessCount", cs.loadSuccessCount()); stat.put("totalLoadTime", SECONDS.convert(cs.totalLoadTime(), NANOSECONDS)); stat.put("loadExceptionCount", cs.loadExceptionCount()); stat.put("evictionCount", cs.evictionCount()); return stat; }
From source file:it.geosolutions.geofence.cache.rest.RESTCacheStats.java
@Override public void handleGet() { // Representation representation = new StringRepresentation(stats.toString()); // getResponse().setEntity(representation); CacheStats stats = crr.getStats(); StringBuilder sb = new StringBuilder().append("RuleStats[").append(" size:").append(crr.getCacheSize()) .append("/").append(crr.getCacheInitParams().getSize()).append(" hitCount:") .append(stats.hitCount()).append(" missCount:").append(stats.missCount()) .append(" loadSuccessCount:").append(stats.loadSuccessCount()).append(" loadExceptionCount:") .append(stats.loadExceptionCount()).append(" totalLoadTime:").append(stats.totalLoadTime()) .append(" evictionCount:").append(stats.evictionCount()).append("] \n"); stats = crr.getUserStats();/*from www . j av a2 s. com*/ sb.append("UserStats[").append(" size:").append(crr.getUserCacheSize()).append("/") .append(crr.getCacheInitParams().getSize()).append(" hitCount:").append(stats.hitCount()) .append(" missCount:").append(stats.missCount()).append(" loadSuccessCount:") .append(stats.loadSuccessCount()).append(" loadExceptionCount:").append(stats.loadExceptionCount()) .append(" totalLoadTime:").append(stats.totalLoadTime()).append(" evictionCount:") .append(stats.evictionCount()).append("] \n"); getResponse().setEntity(new StringRepresentation(sb)); }
From source file:com.turbospaces.core.CacheStatisticsCounter.java
@Override public String toString() { CacheStats snapshot = super.snapshot(); return Objects.toStringHelper(this).add("putsCount", putsCount.get()).add("takesCount", takesCount.get()) .add("exclusiveReadsCount", exclusiveReadsCount.get()).add("hitsCount", snapshot.hitCount()) .add("missCount", snapshot.missCount()).add("loadSuccessCount", snapshot.loadSuccessCount()) .add("loadExceptionCount", snapshot.loadExceptionCount()) .add("loadSuccessRate", snapshot.loadExceptionRate()) .add("loadExceptionRate", snapshot.loadExceptionRate()).toString(); }
From source file:org.geoserver.geofence.cache.rest.RESTCacheStats.java
@Override public void handleGet() { // Representation representation = new StringRepresentation(stats.toString()); // getResponse().setEntity(representation); CacheStats stats = crr.getStats(); StringBuilder sb = new StringBuilder().append("RuleStats[").append(" size:").append(crr.getCacheSize()) .append("/").append(crr.getCacheInitParams().getSize()).append(" hitCount:") .append(stats.hitCount()).append(" missCount:").append(stats.missCount()) .append(" loadSuccessCount:").append(stats.loadSuccessCount()).append(" loadExceptionCount:") .append(stats.loadExceptionCount()).append(" totalLoadTime:").append(stats.totalLoadTime()) .append(" evictionCount:").append(stats.evictionCount()).append("] \n"); stats = crr.getAdminAuthStats();// www . j a va2 s. co m sb.append("AdminAuthStats[").append(" size:").append(crr.getCacheSize()).append("/") .append(crr.getCacheInitParams().getSize()).append(" hitCount:").append(stats.hitCount()) .append(" missCount:").append(stats.missCount()).append(" loadSuccessCount:") .append(stats.loadSuccessCount()).append(" loadExceptionCount:").append(stats.loadExceptionCount()) .append(" totalLoadTime:").append(stats.totalLoadTime()).append(" evictionCount:") .append(stats.evictionCount()).append("] \n"); stats = crr.getUserStats(); sb.append("UserStats[").append(" size:").append(crr.getUserCacheSize()).append("/") .append(crr.getCacheInitParams().getSize()).append(" hitCount:").append(stats.hitCount()) .append(" missCount:").append(stats.missCount()).append(" loadSuccessCount:") .append(stats.loadSuccessCount()).append(" loadExceptionCount:").append(stats.loadExceptionCount()) .append(" totalLoadTime:").append(stats.totalLoadTime()).append(" evictionCount:") .append(stats.evictionCount()).append("] \n"); getResponse().setEntity(new StringRepresentation(sb)); }
From source file:com.github.benmanes.caffeine.guava.CaffeinatedGuavaCache.java
@Override public CacheStats stats() { com.github.benmanes.caffeine.cache.stats.CacheStats stats = cache.stats(); return new CacheStats(stats.hitCount(), stats.missCount(), stats.loadSuccessCount(), stats.loadFailureCount(), stats.totalLoadTime(), stats.evictionCount()); }