changeset 51923:224c202c02a5

8207765: HeapMonitorTest.java intermittent failure Summary: Lower the interval rate and check GC objects too Reviewed-by: dcubed, sspitsyn Contributed-by: jcbeyler@google.com
author jcbeyler
date Wed, 25 Jul 2018 10:51:16 -0700
parents 7087c6657f35
children ec6d5843068a
files test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java	Wed Jul 25 09:48:31 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorTest.java	Wed Jul 25 10:51:16 2018 -0700
@@ -43,16 +43,20 @@
       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<Frame> 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.");
     }