< prev index next >

test/jdk/jdk/jfr/event/gc/stacktrace/AllocationStackTrace.java

Print this page

        

*** 303,313 **** /** * Tests event stacktrace for young GC if -XX:+UseG1GC is used */ public static void testG1YoungAllocEvent() throws Exception { ! GarbageCollectorMXBean bean = garbageCollectorMXBean("G1 Young Generation"); MemoryAllocator memory = new EdenMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testG1YoungAllocEvent" --- 303,313 ---- /** * Tests event stacktrace for young GC if -XX:+UseG1GC is used */ public static void testG1YoungAllocEvent() throws Exception { ! GarbageCollectorMXBean bean = g1YoungGarbageCollectorMXBean(); MemoryAllocator memory = new EdenMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testG1YoungAllocEvent"
*** 315,328 **** testAllocEvent(bean, memory, expectedStack); } /** ! * Tests event stacktrace for old GC if -XX:+UseG1GC is used */ public static void testG1OldAllocEvent() throws Exception { ! GarbageCollectorMXBean bean = garbageCollectorMXBean("G1 Old Generation"); MemoryAllocator memory = new OldGenMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testG1OldAllocEvent" --- 315,328 ---- testAllocEvent(bean, memory, expectedStack); } /** ! * Tests event stacktrace for old/full GC if -XX:+UseG1GC is used */ public static void testG1OldAllocEvent() throws Exception { ! GarbageCollectorMXBean bean = g1FullGarbageCollectorMXBean(); MemoryAllocator memory = new OldGenMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testG1OldAllocEvent"
*** 334,344 **** /** * Tests event stacktrace during metaspace GC threshold if -XX:+UseG1GC is * used */ public static void testMetaspaceG1GCAllocEvent() throws Exception { ! GarbageCollectorMXBean bean = garbageCollectorMXBean("G1 Young Generation"); MemoryAllocator memory = new MetaspaceMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testMetaspaceG1GCAllocEvent" --- 334,344 ---- /** * Tests event stacktrace during metaspace GC threshold if -XX:+UseG1GC is * used */ public static void testMetaspaceG1GCAllocEvent() throws Exception { ! GarbageCollectorMXBean bean = g1YoungGarbageCollectorMXBean(); MemoryAllocator memory = new MetaspaceMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testMetaspaceG1GCAllocEvent"
*** 352,362 **** * -XX:+UseG1GC is used */ public static void testG1HumonAllocEvent() throws Exception { // G1 tries to reclaim humongous objects at every young collection // after doing a conservative estimate of its liveness ! GarbageCollectorMXBean bean = garbageCollectorMXBean("G1 Young Generation"); MemoryAllocator memory = new HumongousMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testG1HumonAllocEvent" --- 352,362 ---- * -XX:+UseG1GC is used */ public static void testG1HumonAllocEvent() throws Exception { // G1 tries to reclaim humongous objects at every young collection // after doing a conservative estimate of its liveness ! GarbageCollectorMXBean bean = g1YoungGarbageCollectorMXBean(); MemoryAllocator memory = new HumongousMemoryAllocator(); String[] expectedStack = new String[]{ "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testAllocEvent", "jdk.jfr.event.gc.stacktrace.AllocationStackTrace.testG1HumonAllocEvent"
*** 365,376 **** testAllocEvent(bean, memory, expectedStack); } private static GarbageCollectorMXBean garbageCollectorMXBean(String name) throws Exception { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); ! GarbageCollectorMXBean bean = ManagementFactory.newPlatformMXBeanProxy( ! server, "java.lang:type=GarbageCollector,name=" + name, GarbageCollectorMXBean.class); return bean; } /** * Performs JFR recording, GC provocation/detection and stacktrace --- 365,398 ---- testAllocEvent(bean, memory, expectedStack); } private static GarbageCollectorMXBean garbageCollectorMXBean(String name) throws Exception { MBeanServer server = ManagementFactory.getPlatformMBeanServer(); ! GarbageCollectorMXBean bean; ! try { ! bean = ManagementFactory.newPlatformMXBeanProxy(server, ! "java.lang:type=GarbageCollector,name=" + name, ! GarbageCollectorMXBean.class); ! } catch (IllegalArgumentException e) { ! bean = null; ! } ! return bean; ! } ! ! private static GarbageCollectorMXBean g1YoungGarbageCollectorMXBean() throws Exception { ! GarbageCollectorMXBean bean = garbageCollectorMXBean("G1 Young Generation"); ! if (bean == null) { ! bean = garbageCollectorMXBean("G1 Young"); ! } ! return bean; ! } ! ! private static GarbageCollectorMXBean g1FullGarbageCollectorMXBean() throws Exception { ! GarbageCollectorMXBean bean = garbageCollectorMXBean("G1 Old Generation"); ! if (bean == null) { ! bean = garbageCollectorMXBean("G1 Full"); ! } return bean; } /** * Performs JFR recording, GC provocation/detection and stacktrace
< prev index next >