From 37bbbcff6d2ded7a479e4ccd695202a8d660d6fe Mon Sep 17 00:00:00 2001 From: Jean Christophe Beyler Date: Wed, 25 Jul 2018 10:51:16 -0700 Subject: [PATCH] 8207765: HeapMonitorTest.java intermittent failure Lower the interval rate and check GC objects too Reviewed-by: dcubed, sspitsyn --- .../jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java index 79487557ffe..b62fa42fce0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java +++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java @@ -43,16 +43,20 @@ public class HeapMonitorTest { HeapMonitor.setAllocationIterations(Integer.parseInt(args[0])); } + // Put sampling rate to 100k to ensure samples are collected. + HeapMonitor.setSamplingInterval(100 * 1024); + if (!HeapMonitor.eventStorageIsEmpty()) { throw new RuntimeException("Storage is not empty at test start..."); } HeapMonitor.enableSamplingEvents(); List frameList = HeapMonitor.allocate(); - frameList.add(new Frame("main", "([Ljava/lang/String;)V", "HeapMonitorTest.java", 51)); + frameList.add(new Frame("main", "([Ljava/lang/String;)V", "HeapMonitorTest.java", 54)); Frame[] frames = frameList.toArray(new Frame[0]); - if (!HeapMonitor.obtainedEvents(frames)) { + if (!HeapMonitor.obtainedEvents(frames) + && !HeapMonitor.garbageContains(frames)) { throw new RuntimeException("Events not found with the right frames."); }