diff --git a/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java b/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java index b332ba8..7007800 100644 --- a/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java +++ b/src/main/java/org/apache/hadoop/hbase/io/hfile/slab/SlabCache.java @@ -64,7 +64,8 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize long size; private final CacheStats stats; - final SlabStats slabstats; + final SlabStats requestStats; + final SlabStats cachedSuccessfullyStats; private final long avgBlockSize; private static final long CACHE_FIXED_OVERHEAD = ClassSize.estimateBase( SlabCache.class, false); @@ -80,7 +81,9 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize this.avgBlockSize = avgBlockSize; this.size = size; this.stats = new CacheStats(); - this.slabstats = new SlabStats(); + this.requestStats = new SlabStats(); + this.cachedSuccessfullyStats = new SlabStats(); + backingStore = new ConcurrentHashMap(); sizer = new TreeMap(); this.scheduleThreadPool.scheduleAtFixedRate(new StatisticsThread(this), @@ -191,12 +194,13 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize Entry scacheEntry = getHigherBlock(cachedItem .getSerializedLength()); - this.slabstats.addin(cachedItem.getSerializedLength()); + this.requestStats.addin(cachedItem.getSerializedLength()); if (scacheEntry == null) { return; // we can't cache, something too big. } + this.cachedSuccessfullyStats.addin(cachedItem.getSerializedLength()); SingleSizeCache scache = scacheEntry.getValue(); scache.cacheBlock(blockName, cachedItem); // if this // fails, due to @@ -312,7 +316,10 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize @Override public void run() { - ourcache.slabstats.logStats(ourcache); + LOG.info("Request Stats"); + ourcache.requestStats.logStats(ourcache); + LOG.info("Successfully Cached Stats"); + ourcache.cachedSuccessfullyStats.logStats(ourcache); } } @@ -353,17 +360,19 @@ public class SlabCache implements SlabItemEvictionWatcher, BlockCache, HeapSize SlabCache.LOG.info("Current heap size is: " + StringUtils.humanReadableInt(slabCache.heapSize())); for (int i = 0; i < fineGrainedStats.length; i++) { - double lowerbound = Math.pow(Math.E, (double) i / (double) multiplier - - 0.5); - double upperbound = Math.pow(Math.E, (double) i / (double) multiplier - + 0.5); - - SlabCache.LOG.info("From " - + StringUtils.humanReadableInt((long) lowerbound) + "- " - + StringUtils.humanReadableInt((long) upperbound) + ": " - + StringUtils.humanReadableInt(fineGrainedStats[i].get()) - + " requests"); - + double lowerbound = Math.pow(Math.E, + ((double) i / (double) multiplier) - 0.5); + double upperbound = Math.pow(Math.E, + ((double) i / (double) multiplier) + 0.5); + + if (fineGrainedStats[i].get() > 0) { + SlabCache.LOG.info("From " + + StringUtils.humanReadableInt((long) lowerbound) + "- " + + StringUtils.humanReadableInt((long) upperbound) + ": " + + StringUtils.humanReadableInt(fineGrainedStats[i].get()) + + " requests"); + + } } } }