< prev index next >

test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java

Print this page

        

*** 48,77 **** this.btype = btype; } public static void main(String[] args) { for (BlobType btype : BlobType.getAvailable()) { - if (CodeCacheUtils.isCodeHeapPredictable(btype)) { new UsageThresholdNotExceededTest(btype).runTest(); } } - } protected void runTest() { MemoryPoolMXBean bean = btype.getMemoryPool(); long initialThresholdCount = bean.getUsageThresholdCount(); long initialUsage = bean.getUsage().getUsed(); bean.setUsageThreshold(initialUsage + 1 + CodeCacheUtils.MIN_ALLOCATION); CodeCacheUtils.WB.allocateCodeBlob(CodeCacheUtils.MIN_ALLOCATION - CodeCacheUtils.getHeaderSize(btype), btype.id); // a gc cycle triggers usage threshold recalculation CodeCacheUtils.WB.fullGC(); ! Asserts.assertEQ(bean.getUsageThresholdCount(), initialThresholdCount, String.format("Usage threshold was hit: %d times for %s. " + "Threshold value: %d with current usage: %d", bean.getUsageThresholdCount(), bean.getName(), bean.getUsageThreshold(), bean.getUsage().getUsed())); ! ! System.out.println("INFO: Case finished successfully for " ! + bean.getName()); } } --- 48,73 ---- this.btype = btype; } public static void main(String[] args) { for (BlobType btype : BlobType.getAvailable()) { new UsageThresholdNotExceededTest(btype).runTest(); } } protected void runTest() { MemoryPoolMXBean bean = btype.getMemoryPool(); long initialThresholdCount = bean.getUsageThresholdCount(); long initialUsage = bean.getUsage().getUsed(); bean.setUsageThreshold(initialUsage + 1 + CodeCacheUtils.MIN_ALLOCATION); CodeCacheUtils.WB.allocateCodeBlob(CodeCacheUtils.MIN_ALLOCATION - CodeCacheUtils.getHeaderSize(btype), btype.id); // a gc cycle triggers usage threshold recalculation CodeCacheUtils.WB.fullGC(); ! CodeCacheUtils.assertEQorGTE(btype, bean.getUsageThresholdCount(), initialThresholdCount, String.format("Usage threshold was hit: %d times for %s. " + "Threshold value: %d with current usage: %d", bean.getUsageThresholdCount(), bean.getName(), bean.getUsageThreshold(), bean.getUsage().getUsed())); ! System.out.println("INFO: Case finished successfully for " + bean.getName()); } }
< prev index next >