http://git-wip-us.apache.org/repos/asf/hbase-site/blob/539ad177/devapidocs/src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html
----------------------------------------------------------------------
diff --git 
a/devapidocs/src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html 
b/devapidocs/src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html
index 2a5efbf..ae7d613 100644
--- a/devapidocs/src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html
+++ b/devapidocs/src-html/org/apache/hadoop/hbase/io/hfile/BlockCacheUtil.html
@@ -39,259 +39,261 @@
 <span class="sourceLineNo">031</span>import 
org.codehaus.jackson.map.ObjectMapper;<a name="line.31"></a>
 <span class="sourceLineNo">032</span>import 
org.codehaus.jackson.map.SerializationConfig;<a name="line.32"></a>
 <span class="sourceLineNo">033</span><a name="line.33"></a>
-<span class="sourceLineNo">034</span>import 
com.yammer.metrics.core.Histogram;<a name="line.34"></a>
-<span class="sourceLineNo">035</span>import 
com.yammer.metrics.core.MetricsRegistry;<a name="line.35"></a>
-<span class="sourceLineNo">036</span>import 
com.yammer.metrics.stats.Snapshot;<a name="line.36"></a>
+<span class="sourceLineNo">034</span>import com.codahale.metrics.Histogram;<a 
name="line.34"></a>
+<span class="sourceLineNo">035</span>import 
com.codahale.metrics.MetricRegistry;<a name="line.35"></a>
+<span class="sourceLineNo">036</span>import com.codahale.metrics.Snapshot;<a 
name="line.36"></a>
 <span class="sourceLineNo">037</span><a name="line.37"></a>
-<span class="sourceLineNo">038</span>/**<a name="line.38"></a>
-<span class="sourceLineNo">039</span> * Utilty for aggregating counts in 
CachedBlocks and toString/toJSON CachedBlocks and BlockCaches.<a 
name="line.39"></a>
-<span class="sourceLineNo">040</span> * No attempt has been made at making 
this thread safe.<a name="line.40"></a>
-<span class="sourceLineNo">041</span> */<a name="line.41"></a>
-<span class="sourceLineNo">042</span>@InterfaceAudience.Private<a 
name="line.42"></a>
-<span class="sourceLineNo">043</span>public class BlockCacheUtil {<a 
name="line.43"></a>
-<span class="sourceLineNo">044</span>  /**<a name="line.44"></a>
-<span class="sourceLineNo">045</span>   * Needed making histograms.<a 
name="line.45"></a>
-<span class="sourceLineNo">046</span>   */<a name="line.46"></a>
-<span class="sourceLineNo">047</span>  private static final MetricsRegistry 
METRICS = new MetricsRegistry();<a name="line.47"></a>
-<span class="sourceLineNo">048</span><a name="line.48"></a>
-<span class="sourceLineNo">049</span>  /**<a name="line.49"></a>
-<span class="sourceLineNo">050</span>   * Needed generating JSON.<a 
name="line.50"></a>
-<span class="sourceLineNo">051</span>   */<a name="line.51"></a>
-<span class="sourceLineNo">052</span>  private static final ObjectMapper 
MAPPER = new ObjectMapper();<a name="line.52"></a>
-<span class="sourceLineNo">053</span>  static {<a name="line.53"></a>
-<span class="sourceLineNo">054</span>    
MAPPER.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);<a 
name="line.54"></a>
-<span class="sourceLineNo">055</span>    
MAPPER.configure(SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE, true);<a 
name="line.55"></a>
-<span class="sourceLineNo">056</span>    
MAPPER.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);<a 
name="line.56"></a>
-<span class="sourceLineNo">057</span>  }<a name="line.57"></a>
-<span class="sourceLineNo">058</span><a name="line.58"></a>
-<span class="sourceLineNo">059</span>  /**<a name="line.59"></a>
-<span class="sourceLineNo">060</span>   * @param cb<a name="line.60"></a>
-<span class="sourceLineNo">061</span>   * @return The block content as 
String.<a name="line.61"></a>
-<span class="sourceLineNo">062</span>   */<a name="line.62"></a>
-<span class="sourceLineNo">063</span>  public static String toString(final 
CachedBlock cb, final long now) {<a name="line.63"></a>
-<span class="sourceLineNo">064</span>    return "filename=" + cb.getFilename() 
+ ", " + toStringMinusFileName(cb, now);<a name="line.64"></a>
-<span class="sourceLineNo">065</span>  }<a name="line.65"></a>
-<span class="sourceLineNo">066</span><a name="line.66"></a>
-<span class="sourceLineNo">067</span>  /**<a name="line.67"></a>
-<span class="sourceLineNo">068</span>   * Little data structure to hold counts 
for a file.<a name="line.68"></a>
-<span class="sourceLineNo">069</span>   * Used doing a toJSON.<a 
name="line.69"></a>
-<span class="sourceLineNo">070</span>   */<a name="line.70"></a>
-<span class="sourceLineNo">071</span>  static class CachedBlockCountsPerFile 
{<a name="line.71"></a>
-<span class="sourceLineNo">072</span>    private int count = 0;<a 
name="line.72"></a>
-<span class="sourceLineNo">073</span>    private long size = 0;<a 
name="line.73"></a>
-<span class="sourceLineNo">074</span>    private int countData = 0;<a 
name="line.74"></a>
-<span class="sourceLineNo">075</span>    private long sizeData = 0;<a 
name="line.75"></a>
-<span class="sourceLineNo">076</span>    private final String filename;<a 
name="line.76"></a>
-<span class="sourceLineNo">077</span><a name="line.77"></a>
-<span class="sourceLineNo">078</span>    CachedBlockCountsPerFile(final String 
filename) {<a name="line.78"></a>
-<span class="sourceLineNo">079</span>      this.filename = filename;<a 
name="line.79"></a>
-<span class="sourceLineNo">080</span>    }<a name="line.80"></a>
-<span class="sourceLineNo">081</span><a name="line.81"></a>
-<span class="sourceLineNo">082</span>    public int getCount() {<a 
name="line.82"></a>
-<span class="sourceLineNo">083</span>      return count;<a name="line.83"></a>
-<span class="sourceLineNo">084</span>    }<a name="line.84"></a>
-<span class="sourceLineNo">085</span><a name="line.85"></a>
-<span class="sourceLineNo">086</span>    public long getSize() {<a 
name="line.86"></a>
-<span class="sourceLineNo">087</span>      return size;<a name="line.87"></a>
-<span class="sourceLineNo">088</span>    }<a name="line.88"></a>
-<span class="sourceLineNo">089</span><a name="line.89"></a>
-<span class="sourceLineNo">090</span>    public int getCountData() {<a 
name="line.90"></a>
-<span class="sourceLineNo">091</span>      return countData;<a 
name="line.91"></a>
-<span class="sourceLineNo">092</span>    }<a name="line.92"></a>
-<span class="sourceLineNo">093</span><a name="line.93"></a>
-<span class="sourceLineNo">094</span>    public long getSizeData() {<a 
name="line.94"></a>
-<span class="sourceLineNo">095</span>      return sizeData;<a 
name="line.95"></a>
-<span class="sourceLineNo">096</span>    }<a name="line.96"></a>
-<span class="sourceLineNo">097</span><a name="line.97"></a>
-<span class="sourceLineNo">098</span>    public String getFilename() {<a 
name="line.98"></a>
-<span class="sourceLineNo">099</span>      return filename;<a 
name="line.99"></a>
-<span class="sourceLineNo">100</span>    }<a name="line.100"></a>
-<span class="sourceLineNo">101</span>  }<a name="line.101"></a>
-<span class="sourceLineNo">102</span><a name="line.102"></a>
-<span class="sourceLineNo">103</span>  /**<a name="line.103"></a>
-<span class="sourceLineNo">104</span>   * @param filename<a 
name="line.104"></a>
-<span class="sourceLineNo">105</span>   * @param blocks<a name="line.105"></a>
-<span class="sourceLineNo">106</span>   * @return A JSON String of 
&lt;code&gt;filename&lt;/code&gt; and counts of 
&lt;code&gt;blocks&lt;/code&gt;<a name="line.106"></a>
-<span class="sourceLineNo">107</span>   * @throws JsonGenerationException<a 
name="line.107"></a>
-<span class="sourceLineNo">108</span>   * @throws JsonMappingException<a 
name="line.108"></a>
-<span class="sourceLineNo">109</span>   * @throws IOException<a 
name="line.109"></a>
-<span class="sourceLineNo">110</span>   */<a name="line.110"></a>
-<span class="sourceLineNo">111</span>  public static String toJSON(final 
String filename, final NavigableSet&lt;CachedBlock&gt; blocks)<a 
name="line.111"></a>
-<span class="sourceLineNo">112</span>  throws JsonGenerationException, 
JsonMappingException, IOException {<a name="line.112"></a>
-<span class="sourceLineNo">113</span>    CachedBlockCountsPerFile counts = new 
CachedBlockCountsPerFile(filename);<a name="line.113"></a>
-<span class="sourceLineNo">114</span>    for (CachedBlock cb: blocks) {<a 
name="line.114"></a>
-<span class="sourceLineNo">115</span>      counts.count++;<a 
name="line.115"></a>
-<span class="sourceLineNo">116</span>      counts.size += cb.getSize();<a 
name="line.116"></a>
-<span class="sourceLineNo">117</span>      BlockType bt = cb.getBlockType();<a 
name="line.117"></a>
-<span class="sourceLineNo">118</span>      if (bt != null &amp;&amp; 
bt.isData()) {<a name="line.118"></a>
-<span class="sourceLineNo">119</span>        counts.countData++;<a 
name="line.119"></a>
-<span class="sourceLineNo">120</span>        counts.sizeData += 
cb.getSize();<a name="line.120"></a>
-<span class="sourceLineNo">121</span>      }<a name="line.121"></a>
-<span class="sourceLineNo">122</span>    }<a name="line.122"></a>
-<span class="sourceLineNo">123</span>    return 
MAPPER.writeValueAsString(counts);<a name="line.123"></a>
-<span class="sourceLineNo">124</span>  }<a name="line.124"></a>
-<span class="sourceLineNo">125</span><a name="line.125"></a>
-<span class="sourceLineNo">126</span>  /**<a name="line.126"></a>
-<span class="sourceLineNo">127</span>   * @param cbsbf<a name="line.127"></a>
-<span class="sourceLineNo">128</span>   * @return JSON string of 
&lt;code&gt;cbsf&lt;/code&gt; aggregated<a name="line.128"></a>
-<span class="sourceLineNo">129</span>   * @throws JsonGenerationException<a 
name="line.129"></a>
-<span class="sourceLineNo">130</span>   * @throws JsonMappingException<a 
name="line.130"></a>
-<span class="sourceLineNo">131</span>   * @throws IOException<a 
name="line.131"></a>
-<span class="sourceLineNo">132</span>   */<a name="line.132"></a>
-<span class="sourceLineNo">133</span>  public static String toJSON(final 
CachedBlocksByFile cbsbf)<a name="line.133"></a>
-<span class="sourceLineNo">134</span>  throws JsonGenerationException, 
JsonMappingException, IOException {<a name="line.134"></a>
-<span class="sourceLineNo">135</span>    return 
MAPPER.writeValueAsString(cbsbf);<a name="line.135"></a>
-<span class="sourceLineNo">136</span>  }<a name="line.136"></a>
-<span class="sourceLineNo">137</span><a name="line.137"></a>
-<span class="sourceLineNo">138</span>  /**<a name="line.138"></a>
-<span class="sourceLineNo">139</span>   * @param bc<a name="line.139"></a>
-<span class="sourceLineNo">140</span>   * @return JSON string of 
&lt;code&gt;bc&lt;/code&gt; content.<a name="line.140"></a>
-<span class="sourceLineNo">141</span>   * @throws JsonGenerationException<a 
name="line.141"></a>
-<span class="sourceLineNo">142</span>   * @throws JsonMappingException<a 
name="line.142"></a>
-<span class="sourceLineNo">143</span>   * @throws IOException<a 
name="line.143"></a>
-<span class="sourceLineNo">144</span>   */<a name="line.144"></a>
-<span class="sourceLineNo">145</span>  public static String toJSON(final 
BlockCache bc)<a name="line.145"></a>
-<span class="sourceLineNo">146</span>  throws JsonGenerationException, 
JsonMappingException, IOException {<a name="line.146"></a>
-<span class="sourceLineNo">147</span>    return 
MAPPER.writeValueAsString(bc);<a name="line.147"></a>
-<span class="sourceLineNo">148</span>  }<a name="line.148"></a>
-<span class="sourceLineNo">149</span><a name="line.149"></a>
-<span class="sourceLineNo">150</span>  /**<a name="line.150"></a>
-<span class="sourceLineNo">151</span>   * @param cb<a name="line.151"></a>
-<span class="sourceLineNo">152</span>   * @return The block content of 
&lt;code&gt;bc&lt;/code&gt; as a String minus the filename.<a 
name="line.152"></a>
-<span class="sourceLineNo">153</span>   */<a name="line.153"></a>
-<span class="sourceLineNo">154</span>  public static String 
toStringMinusFileName(final CachedBlock cb, final long now) {<a 
name="line.154"></a>
-<span class="sourceLineNo">155</span>    return "offset=" + cb.getOffset() +<a 
name="line.155"></a>
-<span class="sourceLineNo">156</span>      ", size=" + cb.getSize() +<a 
name="line.156"></a>
-<span class="sourceLineNo">157</span>      ", age=" + (now - 
cb.getCachedTime()) +<a name="line.157"></a>
-<span class="sourceLineNo">158</span>      ", type=" + cb.getBlockType() +<a 
name="line.158"></a>
-<span class="sourceLineNo">159</span>      ", priority=" + 
cb.getBlockPriority();<a name="line.159"></a>
-<span class="sourceLineNo">160</span>  }<a name="line.160"></a>
-<span class="sourceLineNo">161</span><a name="line.161"></a>
-<span class="sourceLineNo">162</span>  /**<a name="line.162"></a>
-<span class="sourceLineNo">163</span>   * Get a {@link CachedBlocksByFile} 
instance and load it up by iterating content in<a name="line.163"></a>
-<span class="sourceLineNo">164</span>   * {@link BlockCache}.<a 
name="line.164"></a>
-<span class="sourceLineNo">165</span>   * @param conf Used to read 
configurations<a name="line.165"></a>
-<span class="sourceLineNo">166</span>   * @param bc Block Cache to iterate.<a 
name="line.166"></a>
-<span class="sourceLineNo">167</span>   * @return Laoded up instance of 
CachedBlocksByFile<a name="line.167"></a>
-<span class="sourceLineNo">168</span>   */<a name="line.168"></a>
-<span class="sourceLineNo">169</span>  public static CachedBlocksByFile 
getLoadedCachedBlocksByFile(final Configuration conf,<a name="line.169"></a>
-<span class="sourceLineNo">170</span>      final BlockCache bc) {<a 
name="line.170"></a>
-<span class="sourceLineNo">171</span>    CachedBlocksByFile cbsbf = new 
CachedBlocksByFile(conf);<a name="line.171"></a>
-<span class="sourceLineNo">172</span>    for (CachedBlock cb: bc) {<a 
name="line.172"></a>
-<span class="sourceLineNo">173</span>      if (cbsbf.update(cb)) break;<a 
name="line.173"></a>
-<span class="sourceLineNo">174</span>    }<a name="line.174"></a>
-<span class="sourceLineNo">175</span>    return cbsbf;<a name="line.175"></a>
-<span class="sourceLineNo">176</span>  }<a name="line.176"></a>
-<span class="sourceLineNo">177</span><a name="line.177"></a>
-<span class="sourceLineNo">178</span>  /**<a name="line.178"></a>
-<span class="sourceLineNo">179</span>   * Use one of these to keep a running 
account of cached blocks by file.  Throw it away when done.<a 
name="line.179"></a>
-<span class="sourceLineNo">180</span>   * This is different than metrics in 
that it is stats on current state of a cache.<a name="line.180"></a>
-<span class="sourceLineNo">181</span>   * See getLoadedCachedBlocksByFile<a 
name="line.181"></a>
-<span class="sourceLineNo">182</span>   */<a name="line.182"></a>
-<span class="sourceLineNo">183</span>  
@JsonIgnoreProperties({"cachedBlockStatsByFile"})<a name="line.183"></a>
-<span class="sourceLineNo">184</span>  public static class CachedBlocksByFile 
{<a name="line.184"></a>
-<span class="sourceLineNo">185</span>    private int count;<a 
name="line.185"></a>
-<span class="sourceLineNo">186</span>    private int dataBlockCount;<a 
name="line.186"></a>
-<span class="sourceLineNo">187</span>    private long size;<a 
name="line.187"></a>
-<span class="sourceLineNo">188</span>    private long dataSize;<a 
name="line.188"></a>
-<span class="sourceLineNo">189</span>    private final long now = 
System.nanoTime();<a name="line.189"></a>
-<span class="sourceLineNo">190</span>    private final int max;<a 
name="line.190"></a>
-<span class="sourceLineNo">191</span>    public static final int DEFAULT_MAX = 
100000;<a name="line.191"></a>
-<span class="sourceLineNo">192</span> <a name="line.192"></a>
-<span class="sourceLineNo">193</span>    CachedBlocksByFile() {<a 
name="line.193"></a>
-<span class="sourceLineNo">194</span>      this(null);<a name="line.194"></a>
-<span class="sourceLineNo">195</span>    }<a name="line.195"></a>
-<span class="sourceLineNo">196</span><a name="line.196"></a>
-<span class="sourceLineNo">197</span>    CachedBlocksByFile(final 
Configuration c) {<a name="line.197"></a>
-<span class="sourceLineNo">198</span>      this.max = c == null? 
DEFAULT_MAX:<a name="line.198"></a>
-<span class="sourceLineNo">199</span>        
c.getInt("hbase.ui.blockcache.by.file.max", DEFAULT_MAX);<a name="line.199"></a>
-<span class="sourceLineNo">200</span>    }<a name="line.200"></a>
-<span class="sourceLineNo">201</span><a name="line.201"></a>
-<span class="sourceLineNo">202</span>    /**<a name="line.202"></a>
-<span class="sourceLineNo">203</span>     * Map by filename. use concurent 
utils because we want our Map and contained blocks sorted.<a 
name="line.203"></a>
-<span class="sourceLineNo">204</span>     */<a name="line.204"></a>
-<span class="sourceLineNo">205</span>    private NavigableMap&lt;String, 
NavigableSet&lt;CachedBlock&gt;&gt; cachedBlockByFile =<a name="line.205"></a>
-<span class="sourceLineNo">206</span>      new 
ConcurrentSkipListMap&lt;String, NavigableSet&lt;CachedBlock&gt;&gt;();<a 
name="line.206"></a>
-<span class="sourceLineNo">207</span>    Histogram age = 
METRICS.newHistogram(CachedBlocksByFile.class, "age");<a name="line.207"></a>
-<span class="sourceLineNo">208</span><a name="line.208"></a>
-<span class="sourceLineNo">209</span>    /**<a name="line.209"></a>
-<span class="sourceLineNo">210</span>     * @param cb<a name="line.210"></a>
-<span class="sourceLineNo">211</span>     * @return True if full.... if we 
won't be adding any more.<a name="line.211"></a>
-<span class="sourceLineNo">212</span>     */<a name="line.212"></a>
-<span class="sourceLineNo">213</span>    public boolean update(final 
CachedBlock cb) {<a name="line.213"></a>
-<span class="sourceLineNo">214</span>      if (isFull()) return true;<a 
name="line.214"></a>
-<span class="sourceLineNo">215</span>      NavigableSet&lt;CachedBlock&gt; set 
= this.cachedBlockByFile.get(cb.getFilename());<a name="line.215"></a>
-<span class="sourceLineNo">216</span>      if (set == null) {<a 
name="line.216"></a>
-<span class="sourceLineNo">217</span>        set = new 
ConcurrentSkipListSet&lt;CachedBlock&gt;();<a name="line.217"></a>
-<span class="sourceLineNo">218</span>        
this.cachedBlockByFile.put(cb.getFilename(), set);<a name="line.218"></a>
-<span class="sourceLineNo">219</span>      }<a name="line.219"></a>
-<span class="sourceLineNo">220</span>      set.add(cb);<a name="line.220"></a>
-<span class="sourceLineNo">221</span>      this.size += cb.getSize();<a 
name="line.221"></a>
-<span class="sourceLineNo">222</span>      this.count++;<a name="line.222"></a>
-<span class="sourceLineNo">223</span>      BlockType bt = cb.getBlockType();<a 
name="line.223"></a>
-<span class="sourceLineNo">224</span>      if (bt != null &amp;&amp; 
bt.isData()) {<a name="line.224"></a>
-<span class="sourceLineNo">225</span>        this.dataBlockCount++;<a 
name="line.225"></a>
-<span class="sourceLineNo">226</span>        this.dataSize += cb.getSize();<a 
name="line.226"></a>
-<span class="sourceLineNo">227</span>      }<a name="line.227"></a>
-<span class="sourceLineNo">228</span>      long age = this.now - 
cb.getCachedTime();<a name="line.228"></a>
-<span class="sourceLineNo">229</span>      this.age.update(age);<a 
name="line.229"></a>
-<span class="sourceLineNo">230</span>      return false;<a name="line.230"></a>
-<span class="sourceLineNo">231</span>    }<a name="line.231"></a>
-<span class="sourceLineNo">232</span><a name="line.232"></a>
-<span class="sourceLineNo">233</span>    /**<a name="line.233"></a>
-<span class="sourceLineNo">234</span>     * @return True if full; i.e. there 
are more items in the cache but we only loaded up<a name="line.234"></a>
-<span class="sourceLineNo">235</span>     * the maximum set in configuration 
&lt;code&gt;hbase.ui.blockcache.by.file.max&lt;/code&gt;<a name="line.235"></a>
-<span class="sourceLineNo">236</span>     * (Default: DEFAULT_MAX).<a 
name="line.236"></a>
-<span class="sourceLineNo">237</span>     */<a name="line.237"></a>
-<span class="sourceLineNo">238</span>    public boolean isFull() {<a 
name="line.238"></a>
-<span class="sourceLineNo">239</span>      return this.count &gt;= this.max;<a 
name="line.239"></a>
-<span class="sourceLineNo">240</span>    }<a name="line.240"></a>
-<span class="sourceLineNo">241</span> <a name="line.241"></a>
-<span class="sourceLineNo">242</span>    public NavigableMap&lt;String, 
NavigableSet&lt;CachedBlock&gt;&gt; getCachedBlockStatsByFile() {<a 
name="line.242"></a>
-<span class="sourceLineNo">243</span>      return this.cachedBlockByFile;<a 
name="line.243"></a>
-<span class="sourceLineNo">244</span>    }<a name="line.244"></a>
-<span class="sourceLineNo">245</span><a name="line.245"></a>
-<span class="sourceLineNo">246</span>    /**<a name="line.246"></a>
-<span class="sourceLineNo">247</span>     * @return count of blocks in the 
cache<a name="line.247"></a>
-<span class="sourceLineNo">248</span>     */<a name="line.248"></a>
-<span class="sourceLineNo">249</span>    public int getCount() {<a 
name="line.249"></a>
-<span class="sourceLineNo">250</span>      return count;<a name="line.250"></a>
-<span class="sourceLineNo">251</span>    }<a name="line.251"></a>
-<span class="sourceLineNo">252</span><a name="line.252"></a>
-<span class="sourceLineNo">253</span>    public int getDataCount() {<a 
name="line.253"></a>
-<span class="sourceLineNo">254</span>      return dataBlockCount;<a 
name="line.254"></a>
-<span class="sourceLineNo">255</span>    }<a name="line.255"></a>
-<span class="sourceLineNo">256</span><a name="line.256"></a>
-<span class="sourceLineNo">257</span>    /**<a name="line.257"></a>
-<span class="sourceLineNo">258</span>     * @return size of blocks in the 
cache<a name="line.258"></a>
-<span class="sourceLineNo">259</span>     */<a name="line.259"></a>
-<span class="sourceLineNo">260</span>    public long getSize() {<a 
name="line.260"></a>
-<span class="sourceLineNo">261</span>      return size;<a name="line.261"></a>
-<span class="sourceLineNo">262</span>    }<a name="line.262"></a>
-<span class="sourceLineNo">263</span><a name="line.263"></a>
-<span class="sourceLineNo">264</span>    /**<a name="line.264"></a>
-<span class="sourceLineNo">265</span>     * @return Size of data.<a 
name="line.265"></a>
-<span class="sourceLineNo">266</span>     */<a name="line.266"></a>
-<span class="sourceLineNo">267</span>    public long getDataSize() {<a 
name="line.267"></a>
-<span class="sourceLineNo">268</span>      return dataSize;<a 
name="line.268"></a>
-<span class="sourceLineNo">269</span>    }<a name="line.269"></a>
-<span class="sourceLineNo">270</span><a name="line.270"></a>
-<span class="sourceLineNo">271</span>    public AgeSnapshot 
getAgeInCacheSnapshot() {<a name="line.271"></a>
-<span class="sourceLineNo">272</span>      return new AgeSnapshot(this.age);<a 
name="line.272"></a>
-<span class="sourceLineNo">273</span>    }<a name="line.273"></a>
-<span class="sourceLineNo">274</span><a name="line.274"></a>
-<span class="sourceLineNo">275</span>    @Override<a name="line.275"></a>
-<span class="sourceLineNo">276</span>    public String toString() {<a 
name="line.276"></a>
-<span class="sourceLineNo">277</span>      Snapshot snapshot = 
this.age.getSnapshot();<a name="line.277"></a>
-<span class="sourceLineNo">278</span>      return "count=" + count + ", 
dataBlockCount=" + this.dataBlockCount + ", size=" + size +<a 
name="line.278"></a>
-<span class="sourceLineNo">279</span>          ", dataSize=" + getDataSize() 
+<a name="line.279"></a>
-<span class="sourceLineNo">280</span>          ", mean age=" + this.age.mean() 
+ ", stddev age=" + this.age.stdDev() +<a name="line.280"></a>
-<span class="sourceLineNo">281</span>          ", min age=" + this.age.min() + 
", max age=" + this.age.max() +<a name="line.281"></a>
-<span class="sourceLineNo">282</span>          ", 95th percentile age=" + 
snapshot.get95thPercentile() +<a name="line.282"></a>
-<span class="sourceLineNo">283</span>          ", 99th percentile age=" + 
snapshot.get99thPercentile();<a name="line.283"></a>
-<span class="sourceLineNo">284</span>    }<a name="line.284"></a>
-<span class="sourceLineNo">285</span>  }<a name="line.285"></a>
-<span class="sourceLineNo">286</span>}<a name="line.286"></a>
+<span class="sourceLineNo">038</span>import static 
com.codahale.metrics.MetricRegistry.name;<a name="line.38"></a>
+<span class="sourceLineNo">039</span><a name="line.39"></a>
+<span class="sourceLineNo">040</span>/**<a name="line.40"></a>
+<span class="sourceLineNo">041</span> * Utilty for aggregating counts in 
CachedBlocks and toString/toJSON CachedBlocks and BlockCaches.<a 
name="line.41"></a>
+<span class="sourceLineNo">042</span> * No attempt has been made at making 
this thread safe.<a name="line.42"></a>
+<span class="sourceLineNo">043</span> */<a name="line.43"></a>
+<span class="sourceLineNo">044</span>@InterfaceAudience.Private<a 
name="line.44"></a>
+<span class="sourceLineNo">045</span>public class BlockCacheUtil {<a 
name="line.45"></a>
+<span class="sourceLineNo">046</span>  /**<a name="line.46"></a>
+<span class="sourceLineNo">047</span>   * Needed making histograms.<a 
name="line.47"></a>
+<span class="sourceLineNo">048</span>   */<a name="line.48"></a>
+<span class="sourceLineNo">049</span>  private static final MetricRegistry 
METRICS = new MetricRegistry();<a name="line.49"></a>
+<span class="sourceLineNo">050</span><a name="line.50"></a>
+<span class="sourceLineNo">051</span>  /**<a name="line.51"></a>
+<span class="sourceLineNo">052</span>   * Needed generating JSON.<a 
name="line.52"></a>
+<span class="sourceLineNo">053</span>   */<a name="line.53"></a>
+<span class="sourceLineNo">054</span>  private static final ObjectMapper 
MAPPER = new ObjectMapper();<a name="line.54"></a>
+<span class="sourceLineNo">055</span>  static {<a name="line.55"></a>
+<span class="sourceLineNo">056</span>    
MAPPER.configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);<a 
name="line.56"></a>
+<span class="sourceLineNo">057</span>    
MAPPER.configure(SerializationConfig.Feature.FLUSH_AFTER_WRITE_VALUE, true);<a 
name="line.57"></a>
+<span class="sourceLineNo">058</span>    
MAPPER.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);<a 
name="line.58"></a>
+<span class="sourceLineNo">059</span>  }<a name="line.59"></a>
+<span class="sourceLineNo">060</span><a name="line.60"></a>
+<span class="sourceLineNo">061</span>  /**<a name="line.61"></a>
+<span class="sourceLineNo">062</span>   * @param cb<a name="line.62"></a>
+<span class="sourceLineNo">063</span>   * @return The block content as 
String.<a name="line.63"></a>
+<span class="sourceLineNo">064</span>   */<a name="line.64"></a>
+<span class="sourceLineNo">065</span>  public static String toString(final 
CachedBlock cb, final long now) {<a name="line.65"></a>
+<span class="sourceLineNo">066</span>    return "filename=" + cb.getFilename() 
+ ", " + toStringMinusFileName(cb, now);<a name="line.66"></a>
+<span class="sourceLineNo">067</span>  }<a name="line.67"></a>
+<span class="sourceLineNo">068</span><a name="line.68"></a>
+<span class="sourceLineNo">069</span>  /**<a name="line.69"></a>
+<span class="sourceLineNo">070</span>   * Little data structure to hold counts 
for a file.<a name="line.70"></a>
+<span class="sourceLineNo">071</span>   * Used doing a toJSON.<a 
name="line.71"></a>
+<span class="sourceLineNo">072</span>   */<a name="line.72"></a>
+<span class="sourceLineNo">073</span>  static class CachedBlockCountsPerFile 
{<a name="line.73"></a>
+<span class="sourceLineNo">074</span>    private int count = 0;<a 
name="line.74"></a>
+<span class="sourceLineNo">075</span>    private long size = 0;<a 
name="line.75"></a>
+<span class="sourceLineNo">076</span>    private int countData = 0;<a 
name="line.76"></a>
+<span class="sourceLineNo">077</span>    private long sizeData = 0;<a 
name="line.77"></a>
+<span class="sourceLineNo">078</span>    private final String filename;<a 
name="line.78"></a>
+<span class="sourceLineNo">079</span><a name="line.79"></a>
+<span class="sourceLineNo">080</span>    CachedBlockCountsPerFile(final String 
filename) {<a name="line.80"></a>
+<span class="sourceLineNo">081</span>      this.filename = filename;<a 
name="line.81"></a>
+<span class="sourceLineNo">082</span>    }<a name="line.82"></a>
+<span class="sourceLineNo">083</span><a name="line.83"></a>
+<span class="sourceLineNo">084</span>    public int getCount() {<a 
name="line.84"></a>
+<span class="sourceLineNo">085</span>      return count;<a name="line.85"></a>
+<span class="sourceLineNo">086</span>    }<a name="line.86"></a>
+<span class="sourceLineNo">087</span><a name="line.87"></a>
+<span class="sourceLineNo">088</span>    public long getSize() {<a 
name="line.88"></a>
+<span class="sourceLineNo">089</span>      return size;<a name="line.89"></a>
+<span class="sourceLineNo">090</span>    }<a name="line.90"></a>
+<span class="sourceLineNo">091</span><a name="line.91"></a>
+<span class="sourceLineNo">092</span>    public int getCountData() {<a 
name="line.92"></a>
+<span class="sourceLineNo">093</span>      return countData;<a 
name="line.93"></a>
+<span class="sourceLineNo">094</span>    }<a name="line.94"></a>
+<span class="sourceLineNo">095</span><a name="line.95"></a>
+<span class="sourceLineNo">096</span>    public long getSizeData() {<a 
name="line.96"></a>
+<span class="sourceLineNo">097</span>      return sizeData;<a 
name="line.97"></a>
+<span class="sourceLineNo">098</span>    }<a name="line.98"></a>
+<span class="sourceLineNo">099</span><a name="line.99"></a>
+<span class="sourceLineNo">100</span>    public String getFilename() {<a 
name="line.100"></a>
+<span class="sourceLineNo">101</span>      return filename;<a 
name="line.101"></a>
+<span class="sourceLineNo">102</span>    }<a name="line.102"></a>
+<span class="sourceLineNo">103</span>  }<a name="line.103"></a>
+<span class="sourceLineNo">104</span><a name="line.104"></a>
+<span class="sourceLineNo">105</span>  /**<a name="line.105"></a>
+<span class="sourceLineNo">106</span>   * @param filename<a 
name="line.106"></a>
+<span class="sourceLineNo">107</span>   * @param blocks<a name="line.107"></a>
+<span class="sourceLineNo">108</span>   * @return A JSON String of 
&lt;code&gt;filename&lt;/code&gt; and counts of 
&lt;code&gt;blocks&lt;/code&gt;<a name="line.108"></a>
+<span class="sourceLineNo">109</span>   * @throws JsonGenerationException<a 
name="line.109"></a>
+<span class="sourceLineNo">110</span>   * @throws JsonMappingException<a 
name="line.110"></a>
+<span class="sourceLineNo">111</span>   * @throws IOException<a 
name="line.111"></a>
+<span class="sourceLineNo">112</span>   */<a name="line.112"></a>
+<span class="sourceLineNo">113</span>  public static String toJSON(final 
String filename, final NavigableSet&lt;CachedBlock&gt; blocks)<a 
name="line.113"></a>
+<span class="sourceLineNo">114</span>  throws JsonGenerationException, 
JsonMappingException, IOException {<a name="line.114"></a>
+<span class="sourceLineNo">115</span>    CachedBlockCountsPerFile counts = new 
CachedBlockCountsPerFile(filename);<a name="line.115"></a>
+<span class="sourceLineNo">116</span>    for (CachedBlock cb: blocks) {<a 
name="line.116"></a>
+<span class="sourceLineNo">117</span>      counts.count++;<a 
name="line.117"></a>
+<span class="sourceLineNo">118</span>      counts.size += cb.getSize();<a 
name="line.118"></a>
+<span class="sourceLineNo">119</span>      BlockType bt = cb.getBlockType();<a 
name="line.119"></a>
+<span class="sourceLineNo">120</span>      if (bt != null &amp;&amp; 
bt.isData()) {<a name="line.120"></a>
+<span class="sourceLineNo">121</span>        counts.countData++;<a 
name="line.121"></a>
+<span class="sourceLineNo">122</span>        counts.sizeData += 
cb.getSize();<a name="line.122"></a>
+<span class="sourceLineNo">123</span>      }<a name="line.123"></a>
+<span class="sourceLineNo">124</span>    }<a name="line.124"></a>
+<span class="sourceLineNo">125</span>    return 
MAPPER.writeValueAsString(counts);<a name="line.125"></a>
+<span class="sourceLineNo">126</span>  }<a name="line.126"></a>
+<span class="sourceLineNo">127</span><a name="line.127"></a>
+<span class="sourceLineNo">128</span>  /**<a name="line.128"></a>
+<span class="sourceLineNo">129</span>   * @param cbsbf<a name="line.129"></a>
+<span class="sourceLineNo">130</span>   * @return JSON string of 
&lt;code&gt;cbsf&lt;/code&gt; aggregated<a name="line.130"></a>
+<span class="sourceLineNo">131</span>   * @throws JsonGenerationException<a 
name="line.131"></a>
+<span class="sourceLineNo">132</span>   * @throws JsonMappingException<a 
name="line.132"></a>
+<span class="sourceLineNo">133</span>   * @throws IOException<a 
name="line.133"></a>
+<span class="sourceLineNo">134</span>   */<a name="line.134"></a>
+<span class="sourceLineNo">135</span>  public static String toJSON(final 
CachedBlocksByFile cbsbf)<a name="line.135"></a>
+<span class="sourceLineNo">136</span>  throws JsonGenerationException, 
JsonMappingException, IOException {<a name="line.136"></a>
+<span class="sourceLineNo">137</span>    return 
MAPPER.writeValueAsString(cbsbf);<a name="line.137"></a>
+<span class="sourceLineNo">138</span>  }<a name="line.138"></a>
+<span class="sourceLineNo">139</span><a name="line.139"></a>
+<span class="sourceLineNo">140</span>  /**<a name="line.140"></a>
+<span class="sourceLineNo">141</span>   * @param bc<a name="line.141"></a>
+<span class="sourceLineNo">142</span>   * @return JSON string of 
&lt;code&gt;bc&lt;/code&gt; content.<a name="line.142"></a>
+<span class="sourceLineNo">143</span>   * @throws JsonGenerationException<a 
name="line.143"></a>
+<span class="sourceLineNo">144</span>   * @throws JsonMappingException<a 
name="line.144"></a>
+<span class="sourceLineNo">145</span>   * @throws IOException<a 
name="line.145"></a>
+<span class="sourceLineNo">146</span>   */<a name="line.146"></a>
+<span class="sourceLineNo">147</span>  public static String toJSON(final 
BlockCache bc)<a name="line.147"></a>
+<span class="sourceLineNo">148</span>  throws JsonGenerationException, 
JsonMappingException, IOException {<a name="line.148"></a>
+<span class="sourceLineNo">149</span>    return 
MAPPER.writeValueAsString(bc);<a name="line.149"></a>
+<span class="sourceLineNo">150</span>  }<a name="line.150"></a>
+<span class="sourceLineNo">151</span><a name="line.151"></a>
+<span class="sourceLineNo">152</span>  /**<a name="line.152"></a>
+<span class="sourceLineNo">153</span>   * @param cb<a name="line.153"></a>
+<span class="sourceLineNo">154</span>   * @return The block content of 
&lt;code&gt;bc&lt;/code&gt; as a String minus the filename.<a 
name="line.154"></a>
+<span class="sourceLineNo">155</span>   */<a name="line.155"></a>
+<span class="sourceLineNo">156</span>  public static String 
toStringMinusFileName(final CachedBlock cb, final long now) {<a 
name="line.156"></a>
+<span class="sourceLineNo">157</span>    return "offset=" + cb.getOffset() +<a 
name="line.157"></a>
+<span class="sourceLineNo">158</span>      ", size=" + cb.getSize() +<a 
name="line.158"></a>
+<span class="sourceLineNo">159</span>      ", age=" + (now - 
cb.getCachedTime()) +<a name="line.159"></a>
+<span class="sourceLineNo">160</span>      ", type=" + cb.getBlockType() +<a 
name="line.160"></a>
+<span class="sourceLineNo">161</span>      ", priority=" + 
cb.getBlockPriority();<a name="line.161"></a>
+<span class="sourceLineNo">162</span>  }<a name="line.162"></a>
+<span class="sourceLineNo">163</span><a name="line.163"></a>
+<span class="sourceLineNo">164</span>  /**<a name="line.164"></a>
+<span class="sourceLineNo">165</span>   * Get a {@link CachedBlocksByFile} 
instance and load it up by iterating content in<a name="line.165"></a>
+<span class="sourceLineNo">166</span>   * {@link BlockCache}.<a 
name="line.166"></a>
+<span class="sourceLineNo">167</span>   * @param conf Used to read 
configurations<a name="line.167"></a>
+<span class="sourceLineNo">168</span>   * @param bc Block Cache to iterate.<a 
name="line.168"></a>
+<span class="sourceLineNo">169</span>   * @return Laoded up instance of 
CachedBlocksByFile<a name="line.169"></a>
+<span class="sourceLineNo">170</span>   */<a name="line.170"></a>
+<span class="sourceLineNo">171</span>  public static CachedBlocksByFile 
getLoadedCachedBlocksByFile(final Configuration conf,<a name="line.171"></a>
+<span class="sourceLineNo">172</span>      final BlockCache bc) {<a 
name="line.172"></a>
+<span class="sourceLineNo">173</span>    CachedBlocksByFile cbsbf = new 
CachedBlocksByFile(conf);<a name="line.173"></a>
+<span class="sourceLineNo">174</span>    for (CachedBlock cb: bc) {<a 
name="line.174"></a>
+<span class="sourceLineNo">175</span>      if (cbsbf.update(cb)) break;<a 
name="line.175"></a>
+<span class="sourceLineNo">176</span>    }<a name="line.176"></a>
+<span class="sourceLineNo">177</span>    return cbsbf;<a name="line.177"></a>
+<span class="sourceLineNo">178</span>  }<a name="line.178"></a>
+<span class="sourceLineNo">179</span><a name="line.179"></a>
+<span class="sourceLineNo">180</span>  /**<a name="line.180"></a>
+<span class="sourceLineNo">181</span>   * Use one of these to keep a running 
account of cached blocks by file.  Throw it away when done.<a 
name="line.181"></a>
+<span class="sourceLineNo">182</span>   * This is different than metrics in 
that it is stats on current state of a cache.<a name="line.182"></a>
+<span class="sourceLineNo">183</span>   * See getLoadedCachedBlocksByFile<a 
name="line.183"></a>
+<span class="sourceLineNo">184</span>   */<a name="line.184"></a>
+<span class="sourceLineNo">185</span>  
@JsonIgnoreProperties({"cachedBlockStatsByFile"})<a name="line.185"></a>
+<span class="sourceLineNo">186</span>  public static class CachedBlocksByFile 
{<a name="line.186"></a>
+<span class="sourceLineNo">187</span>    private int count;<a 
name="line.187"></a>
+<span class="sourceLineNo">188</span>    private int dataBlockCount;<a 
name="line.188"></a>
+<span class="sourceLineNo">189</span>    private long size;<a 
name="line.189"></a>
+<span class="sourceLineNo">190</span>    private long dataSize;<a 
name="line.190"></a>
+<span class="sourceLineNo">191</span>    private final long now = 
System.nanoTime();<a name="line.191"></a>
+<span class="sourceLineNo">192</span>    private final int max;<a 
name="line.192"></a>
+<span class="sourceLineNo">193</span>    public static final int DEFAULT_MAX = 
100000;<a name="line.193"></a>
+<span class="sourceLineNo">194</span><a name="line.194"></a>
+<span class="sourceLineNo">195</span>    CachedBlocksByFile() {<a 
name="line.195"></a>
+<span class="sourceLineNo">196</span>      this(null);<a name="line.196"></a>
+<span class="sourceLineNo">197</span>    }<a name="line.197"></a>
+<span class="sourceLineNo">198</span><a name="line.198"></a>
+<span class="sourceLineNo">199</span>    CachedBlocksByFile(final 
Configuration c) {<a name="line.199"></a>
+<span class="sourceLineNo">200</span>      this.max = c == null? 
DEFAULT_MAX:<a name="line.200"></a>
+<span class="sourceLineNo">201</span>        
c.getInt("hbase.ui.blockcache.by.file.max", DEFAULT_MAX);<a name="line.201"></a>
+<span class="sourceLineNo">202</span>    }<a name="line.202"></a>
+<span class="sourceLineNo">203</span><a name="line.203"></a>
+<span class="sourceLineNo">204</span>    /**<a name="line.204"></a>
+<span class="sourceLineNo">205</span>     * Map by filename. use concurent 
utils because we want our Map and contained blocks sorted.<a 
name="line.205"></a>
+<span class="sourceLineNo">206</span>     */<a name="line.206"></a>
+<span class="sourceLineNo">207</span>    private NavigableMap&lt;String, 
NavigableSet&lt;CachedBlock&gt;&gt; cachedBlockByFile =<a name="line.207"></a>
+<span class="sourceLineNo">208</span>      new 
ConcurrentSkipListMap&lt;String, NavigableSet&lt;CachedBlock&gt;&gt;();<a 
name="line.208"></a>
+<span class="sourceLineNo">209</span>    Histogram age = 
METRICS.histogram(name(CachedBlocksByFile.class, "age"));<a name="line.209"></a>
+<span class="sourceLineNo">210</span><a name="line.210"></a>
+<span class="sourceLineNo">211</span>    /**<a name="line.211"></a>
+<span class="sourceLineNo">212</span>     * @param cb<a name="line.212"></a>
+<span class="sourceLineNo">213</span>     * @return True if full.... if we 
won't be adding any more.<a name="line.213"></a>
+<span class="sourceLineNo">214</span>     */<a name="line.214"></a>
+<span class="sourceLineNo">215</span>    public boolean update(final 
CachedBlock cb) {<a name="line.215"></a>
+<span class="sourceLineNo">216</span>      if (isFull()) return true;<a 
name="line.216"></a>
+<span class="sourceLineNo">217</span>      NavigableSet&lt;CachedBlock&gt; set 
= this.cachedBlockByFile.get(cb.getFilename());<a name="line.217"></a>
+<span class="sourceLineNo">218</span>      if (set == null) {<a 
name="line.218"></a>
+<span class="sourceLineNo">219</span>        set = new 
ConcurrentSkipListSet&lt;CachedBlock&gt;();<a name="line.219"></a>
+<span class="sourceLineNo">220</span>        
this.cachedBlockByFile.put(cb.getFilename(), set);<a name="line.220"></a>
+<span class="sourceLineNo">221</span>      }<a name="line.221"></a>
+<span class="sourceLineNo">222</span>      set.add(cb);<a name="line.222"></a>
+<span class="sourceLineNo">223</span>      this.size += cb.getSize();<a 
name="line.223"></a>
+<span class="sourceLineNo">224</span>      this.count++;<a name="line.224"></a>
+<span class="sourceLineNo">225</span>      BlockType bt = cb.getBlockType();<a 
name="line.225"></a>
+<span class="sourceLineNo">226</span>      if (bt != null &amp;&amp; 
bt.isData()) {<a name="line.226"></a>
+<span class="sourceLineNo">227</span>        this.dataBlockCount++;<a 
name="line.227"></a>
+<span class="sourceLineNo">228</span>        this.dataSize += cb.getSize();<a 
name="line.228"></a>
+<span class="sourceLineNo">229</span>      }<a name="line.229"></a>
+<span class="sourceLineNo">230</span>      long age = this.now - 
cb.getCachedTime();<a name="line.230"></a>
+<span class="sourceLineNo">231</span>      this.age.update(age);<a 
name="line.231"></a>
+<span class="sourceLineNo">232</span>      return false;<a name="line.232"></a>
+<span class="sourceLineNo">233</span>    }<a name="line.233"></a>
+<span class="sourceLineNo">234</span><a name="line.234"></a>
+<span class="sourceLineNo">235</span>    /**<a name="line.235"></a>
+<span class="sourceLineNo">236</span>     * @return True if full; i.e. there 
are more items in the cache but we only loaded up<a name="line.236"></a>
+<span class="sourceLineNo">237</span>     * the maximum set in configuration 
&lt;code&gt;hbase.ui.blockcache.by.file.max&lt;/code&gt;<a name="line.237"></a>
+<span class="sourceLineNo">238</span>     * (Default: DEFAULT_MAX).<a 
name="line.238"></a>
+<span class="sourceLineNo">239</span>     */<a name="line.239"></a>
+<span class="sourceLineNo">240</span>    public boolean isFull() {<a 
name="line.240"></a>
+<span class="sourceLineNo">241</span>      return this.count &gt;= this.max;<a 
name="line.241"></a>
+<span class="sourceLineNo">242</span>    }<a name="line.242"></a>
+<span class="sourceLineNo">243</span> <a name="line.243"></a>
+<span class="sourceLineNo">244</span>    public NavigableMap&lt;String, 
NavigableSet&lt;CachedBlock&gt;&gt; getCachedBlockStatsByFile() {<a 
name="line.244"></a>
+<span class="sourceLineNo">245</span>      return this.cachedBlockByFile;<a 
name="line.245"></a>
+<span class="sourceLineNo">246</span>    }<a name="line.246"></a>
+<span class="sourceLineNo">247</span><a name="line.247"></a>
+<span class="sourceLineNo">248</span>    /**<a name="line.248"></a>
+<span class="sourceLineNo">249</span>     * @return count of blocks in the 
cache<a name="line.249"></a>
+<span class="sourceLineNo">250</span>     */<a name="line.250"></a>
+<span class="sourceLineNo">251</span>    public int getCount() {<a 
name="line.251"></a>
+<span class="sourceLineNo">252</span>      return count;<a name="line.252"></a>
+<span class="sourceLineNo">253</span>    }<a name="line.253"></a>
+<span class="sourceLineNo">254</span><a name="line.254"></a>
+<span class="sourceLineNo">255</span>    public int getDataCount() {<a 
name="line.255"></a>
+<span class="sourceLineNo">256</span>      return dataBlockCount;<a 
name="line.256"></a>
+<span class="sourceLineNo">257</span>    }<a name="line.257"></a>
+<span class="sourceLineNo">258</span><a name="line.258"></a>
+<span class="sourceLineNo">259</span>    /**<a name="line.259"></a>
+<span class="sourceLineNo">260</span>     * @return size of blocks in the 
cache<a name="line.260"></a>
+<span class="sourceLineNo">261</span>     */<a name="line.261"></a>
+<span class="sourceLineNo">262</span>    public long getSize() {<a 
name="line.262"></a>
+<span class="sourceLineNo">263</span>      return size;<a name="line.263"></a>
+<span class="sourceLineNo">264</span>    }<a name="line.264"></a>
+<span class="sourceLineNo">265</span><a name="line.265"></a>
+<span class="sourceLineNo">266</span>    /**<a name="line.266"></a>
+<span class="sourceLineNo">267</span>     * @return Size of data.<a 
name="line.267"></a>
+<span class="sourceLineNo">268</span>     */<a name="line.268"></a>
+<span class="sourceLineNo">269</span>    public long getDataSize() {<a 
name="line.269"></a>
+<span class="sourceLineNo">270</span>      return dataSize;<a 
name="line.270"></a>
+<span class="sourceLineNo">271</span>    }<a name="line.271"></a>
+<span class="sourceLineNo">272</span><a name="line.272"></a>
+<span class="sourceLineNo">273</span>    public AgeSnapshot 
getAgeInCacheSnapshot() {<a name="line.273"></a>
+<span class="sourceLineNo">274</span>      return new AgeSnapshot(this.age);<a 
name="line.274"></a>
+<span class="sourceLineNo">275</span>    }<a name="line.275"></a>
+<span class="sourceLineNo">276</span><a name="line.276"></a>
+<span class="sourceLineNo">277</span>    @Override<a name="line.277"></a>
+<span class="sourceLineNo">278</span>    public String toString() {<a 
name="line.278"></a>
+<span class="sourceLineNo">279</span>      Snapshot snapshot = 
age.getSnapshot();<a name="line.279"></a>
+<span class="sourceLineNo">280</span>      return "count=" + count + ", 
dataBlockCount=" + dataBlockCount + ", size=" + size +<a name="line.280"></a>
+<span class="sourceLineNo">281</span>          ", dataSize=" + getDataSize() 
+<a name="line.281"></a>
+<span class="sourceLineNo">282</span>          ", mean age=" + 
snapshot.getMean() + ", stddev age=" + snapshot.getStdDev() +<a 
name="line.282"></a>
+<span class="sourceLineNo">283</span>          ", min age=" + 
snapshot.getMin() + ", max age=" + snapshot.getMax() +<a name="line.283"></a>
+<span class="sourceLineNo">284</span>          ", 95th percentile age=" + 
snapshot.get95thPercentile() +<a name="line.284"></a>
+<span class="sourceLineNo">285</span>          ", 99th percentile age=" + 
snapshot.get99thPercentile();<a name="line.285"></a>
+<span class="sourceLineNo">286</span>    }<a name="line.286"></a>
+<span class="sourceLineNo">287</span>  }<a name="line.287"></a>
+<span class="sourceLineNo">288</span>}<a name="line.288"></a>
 
 
 

Reply via email to