CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ stats.getName(), stats.getRequestCount(), stats.getHitCount(), new BigDecimal(stats.getHitRate(),new MathContext(2)), stats.getMissCount(), new BigDecimal(stats.getMissRate(), new MathContext(2)), stats.getLoadCount(), stats.getLoadSuccessCount(), stats.getLoadExceptionCount(), timeInWords(stats.getTotalLoadTime()), TimeUnit.NANOSECONDS.toMillis((long) stats.getAverageLoadPenalty()) + "ms", stats.getEvictionCount(), stats.getElementCount(), humanReadableByteCount(stats.estimateCurrentWeight()), humanReadableByteCount(stats.estimateCurrentMemoryWeight()), humanReadableByteCount(stats.getMaxTotalWeight()), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ stats.getName(), stats.getRequestCount(), stats.getHitCount(), new BigDecimal(stats.getHitRate(),new MathContext(2)), stats.getMissCount(), new BigDecimal(stats.getMissRate(), new MathContext(2)), stats.getLoadCount(), stats.getLoadSuccessCount(), stats.getLoadExceptionCount(), timeInWords(stats.getTotalLoadTime()), TimeUnit.NANOSECONDS.toMillis((long) stats.getAverageLoadPenalty()) + "ms", stats.getEvictionCount(), stats.getElementCount(), humanReadableByteCount(stats.estimateCurrentWeight()), humanReadableByteCount(stats.estimateCurrentMemoryWeight()), humanReadableByteCount(stats.getMaxTotalWeight()), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
CompositeDataSupport toCompositeData() { Object[] values = new Object[]{ stats.getName(), stats.getRequestCount(), stats.getHitCount(), new BigDecimal(stats.getHitRate(),new MathContext(2)), stats.getMissCount(), new BigDecimal(stats.getMissRate(), new MathContext(2)), stats.getLoadCount(), stats.getLoadSuccessCount(), stats.getLoadExceptionCount(), timeInWords(stats.getTotalLoadTime()), TimeUnit.NANOSECONDS.toMillis((long) stats.getAverageLoadPenalty()) + "ms", stats.getEvictionCount(), stats.getElementCount(), humanReadableByteCount(stats.estimateCurrentWeight()), humanReadableByteCount(stats.estimateCurrentMemoryWeight()), humanReadableByteCount(stats.getMaxTotalWeight()), }; try { return new CompositeDataSupport(TYPE, FIELD_NAMES, values); } catch (OpenDataException e) { throw new IllegalStateException(e); } } }
private static void assertCacheStats(DataStoreCacheStatsMBean cache, long elems, long weight, long hits, long count) { assertEquals("elements don't match", elems, cache.getElementCount()); assertEquals("weight doesn't match", weight, cache.estimateCurrentWeight()); assertEquals("hits count don't match", hits, cache.getHitCount()); assertEquals("requests count don't match", count, cache.getRequestCount()); }
private static void assertCacheStats(UploadStagingCache cache, long elems, long weight, long hits, long count) { assertEquals(elems, cache.getStats().getElementCount()); assertEquals(weight, cache.getStats().estimateCurrentWeight()); assertEquals(hits, cache.getStats().getHitCount()); assertEquals(count, cache.getStats().getRequestCount()); } }