8028647: Add instrumentation in GetSafepointSyncTime.java and remove it from ProblemList.txt
Reviewed-by: sla, chegar
diff --git a/test/ProblemList.txt b/test/ProblemList.txt
index e213d7a..7c7c84c 100644
--- a/test/ProblemList.txt
+++ b/test/ProblemList.txt
@@ -129,9 +129,6 @@
# jdk_management
-# 8010897
-sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java macosx-all
-
# 8028150
sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh windows-all
diff --git a/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java b/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java
index 16ec619..bd37193 100644
--- a/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java
+++ b/test/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java
@@ -45,12 +45,9 @@
private static final long MIN_VALUE_FOR_PASS = 1;
private static final long MAX_VALUE_FOR_PASS = Long.MAX_VALUE;
- private static boolean trace = false;
-
public static void main(String args[]) throws Exception {
- if (args.length > 0 && args[0].equals("trace")) {
- trace = true;
- }
+ long count = mbean.getSafepointCount();
+ long value = mbean.getSafepointSyncTime();
// Thread.getAllStackTraces() should cause safepoints.
// If this test is failing because it doesn't,
@@ -59,15 +56,15 @@
Thread.getAllStackTraces();
}
- long value = mbean.getSafepointSyncTime();
+ long count1 = mbean.getSafepointCount();
+ long value1 = mbean.getSafepointSyncTime();
- if (trace) {
- System.out.println("Safepoint sync time (ms): " + value);
- }
+ System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
+ count1, count1-count, value1, value1-value);
- if (value < MIN_VALUE_FOR_PASS || value > MAX_VALUE_FOR_PASS) {
+ if (value1 < MIN_VALUE_FOR_PASS || value1 > MAX_VALUE_FOR_PASS) {
throw new RuntimeException("Safepoint sync time " +
- "illegal value: " + value + " ms " +
+ "illegal value: " + value1 + " ms " +
"(MIN = " + MIN_VALUE_FOR_PASS + "; " +
"MAX = " + MAX_VALUE_FOR_PASS + ")");
}
@@ -76,16 +73,16 @@
Thread.getAllStackTraces();
}
+ long count2 = mbean.getSafepointCount();
long value2 = mbean.getSafepointSyncTime();
- if (trace) {
- System.out.println("Safepoint sync time2 (ms): " + value2);
- }
+ System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
+ count2, count2-count1, value2, value2-value1);
- if (value2 <= value) {
+ if (value2 <= value1) {
throw new RuntimeException("Safepoint sync time " +
"did not increase " +
- "(value = " + value + "; " +
+ "(value1 = " + value1 + "; " +
"value2 = " + value2 + ")");
}