Example usage for com.google.common.cache CacheStats missCount

List of usage examples for com.google.common.cache CacheStats missCount

Introduction

In this page you can find the example usage for com.google.common.cache CacheStats missCount.

Prototype

long missCount

To view the source code for com.google.common.cache CacheStats missCount.

Click Source Link

Usage

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   w  ww. jav  a  2 s  .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: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() });
    }//from  w w  w  .ja  v a  2 s. c om
}

From source file:com.oneops.opamp.ws.OpampWsController.java

/**
* Get the current WatchedByAttributeCache  status. Returns the cumulative status of
* <ul>/*from   w  w w .java 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 = 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: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);/*from  w w w . j a va 2s.com*/
    }
}

From source file:com.oneops.antenna.ws.AntennaWsController.java

/**
 * Get the current sink cache status. Returns the cumulative status of
 * <ul>//from  ww w .j a va2  s  . co 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.units.malelab.ege.core.listener.collector.CacheStatistics.java

@Override
public Map<String, Object> collect(GenerationEvent generationEvent) {
    CacheStats mappingStats = (CacheStats) generationEvent.getData().get(StandardEvolver.MAPPING_CACHE_NAME);
    CacheStats fitnessStats = (CacheStats) generationEvent.getData().get(StandardEvolver.FITNESS_CACHE_NAME);
    Map<String, Object> map = new LinkedHashMap<>();
    map.put("cache.mapping.miss.count", mappingStats.missCount());
    map.put("cache.mapping.hit.rate", mappingStats.hitRate());
    map.put("cache.mapping.avg.load.penalty", mappingStats.averageLoadPenalty() / 1000);
    map.put("cache.fitness.miss.count", fitnessStats.missCount());
    map.put("cache.fitness.hit.rate", fitnessStats.hitRate());
    map.put("cache.fitness.avg.load.penalty", fitnessStats.averageLoadPenalty() / 1000);
    return map;// ww w . j  ava  2s .co m
}

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();/*  w  ww  .j av a 2 s  .c  om*/
    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());
}

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();/* ww  w  . j ava 2 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));
}