HBASE-15635 Mean age of Blocks in cache (seconds) on webUI should be greater than zero
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
parent
2261c8c31a
commit
fb4ef53571
|
@ -177,7 +177,6 @@ org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
|
|||
<%java>
|
||||
AgeSnapshot ageAtEvictionSnapshot = bc.getStats().getAgeAtEvictionSnapshot();
|
||||
// Only show if non-zero mean and stddev as is the case in combinedblockcache
|
||||
double mean = ageAtEvictionSnapshot.getMean();
|
||||
</%java>
|
||||
<tr>
|
||||
<td>Evicted</td>
|
||||
|
@ -189,13 +188,11 @@ org.apache.hadoop.util.StringUtils.TraditionalBinaryPrefix;
|
|||
<td><% String.format("%,d", bc.getStats().getEvictionCount()) %></td>
|
||||
<td>The total number of times an eviction has occurred</td>
|
||||
</tr>
|
||||
<%if mean > 0 %>
|
||||
<tr>
|
||||
<td>Mean</td>
|
||||
<td><% String.format("%,d", (long)(ageAtEvictionSnapshot.getMean()/(1000000 * 1000))) %></td>
|
||||
<td><% String.format("%,d", (long)ageAtEvictionSnapshot.getMean()) %></td>
|
||||
<td>Mean age of Blocks at eviction time (seconds)</td>
|
||||
</tr>
|
||||
</%if>
|
||||
</%def>
|
||||
|
||||
<%def hits_tmpl>
|
||||
|
@ -288,7 +285,6 @@ are combined counts. Request count is sum of hits and misses.</p>
|
|||
boolean evictions;
|
||||
</%args>
|
||||
<%java>
|
||||
final long nanosPerSecond = 1000000000;
|
||||
String bcUrl = "http://hbase.apache.org/devapidocs/" + bc.getClass().getName().replaceAll("\\.", "/") + ".html";
|
||||
String bcName = bc.getClass().getSimpleName();
|
||||
org.apache.hadoop.hbase.io.hfile.BlockCacheUtil.CachedBlocksByFile cbsbf =
|
||||
|
|
|
@ -39,6 +39,10 @@ import org.codehaus.jackson.map.SerializationConfig;
|
|||
*/
|
||||
@InterfaceAudience.Private
|
||||
public class BlockCacheUtil {
|
||||
|
||||
|
||||
public static final long NANOS_PER_SECOND = 1000000000;
|
||||
|
||||
/**
|
||||
* Needed generating JSON.
|
||||
*/
|
||||
|
@ -224,7 +228,7 @@ public class BlockCacheUtil {
|
|||
this.dataBlockCount++;
|
||||
this.dataSize += cb.getSize();
|
||||
}
|
||||
long age = this.now - cb.getCachedTime();
|
||||
long age = (this.now - cb.getCachedTime())/NANOS_PER_SECOND;
|
||||
this.hist.add(age, 1);
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -248,7 +248,9 @@ public class CacheStats {
|
|||
}
|
||||
|
||||
public void evicted(final long t, boolean primary) {
|
||||
if (t > this.startTime) this.ageAtEviction.add(t - this.startTime,1);
|
||||
if (t > this.startTime) {
|
||||
this.ageAtEviction.add((t - this.startTime) / BlockCacheUtil.NANOS_PER_SECOND, 1);
|
||||
}
|
||||
this.evictedBlockCount.increment();
|
||||
if (primary) {
|
||||
primaryEvictedBlockCount.increment();
|
||||
|
|
Loading…
Reference in New Issue