private BlockCacheUtil.CachedBlocksByFile logPerBlock(final BlockCache bc) throws JsonGenerationException, JsonMappingException, IOException { BlockCacheUtil.CachedBlocksByFile cbsbf = new BlockCacheUtil.CachedBlocksByFile(); for (CachedBlock cb : bc) { LOG.info(cb.toString()); LOG.info(BlockCacheUtil.toJSON(bc)); cbsbf.update(cb); } return cbsbf; }
private void logPerFile(final BlockCacheUtil.CachedBlocksByFile cbsbf) throws JsonGenerationException, JsonMappingException, IOException { for (Map.Entry<String, NavigableSet<CachedBlock>> e : cbsbf.getCachedBlockStatsByFile().entrySet()) { int count = 0; long size = 0; int countData = 0; long sizeData = 0; for (CachedBlock cb : e.getValue()) { count++; size += cb.getSize(); BlockType bt = cb.getBlockType(); if (bt != null && bt.isData()) { countData++; sizeData += cb.getSize(); } } LOG.info( "filename=" + e.getKey() + ", count=" + count + ", countData=" + countData + ", size=" + size + ", sizeData=" + sizeData); LOG.info(BlockCacheUtil.toJSON(e.getKey(), e.getValue())); } }