8205652: serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatRateTest.java fails
Fix the StatRateTest test from the HeapMonitor package Reviewed-by: amenkov, sspitsyn
This commit is contained in:
parent
6f9cb3f9ca
commit
4e92c2dfdc
@ -81,7 +81,6 @@ runtime/CompressedOops/UseCompressedOops.java 8079353 generic-all
|
||||
|
||||
serviceability/sa/TestRevPtrsForInvokeDynamic.java 8191270 generic-all
|
||||
serviceability/sa/sadebugd/SADebugDTest.java 8163805 generic-all
|
||||
serviceability/jvmti/HeapMonitor/MyPackage/HeapMonitorStatRateTest.java 8205652 generic-all
|
||||
|
||||
#############################################################################
|
||||
|
||||
|
@ -43,24 +43,30 @@ public class HeapMonitorStatRateTest {
|
||||
HeapMonitor.enableSamplingEvents();
|
||||
|
||||
int allocationTotal = 10 * 1024 * 1024;
|
||||
HeapMonitor.allocateSize(allocationTotal);
|
||||
int allocationIterations = 10;
|
||||
|
||||
double actualCount = 0;
|
||||
for (int i = 0; i < allocationIterations; i++) {
|
||||
HeapMonitor.resetEventStorage();
|
||||
HeapMonitor.allocateSize(allocationTotal);
|
||||
actualCount += HeapMonitor.getEventStorageElementCount();
|
||||
}
|
||||
|
||||
HeapMonitor.disableSamplingEvents();
|
||||
|
||||
double actualCount = HeapMonitor.getEventStorageElementCount();
|
||||
double expectedCount = allocationTotal / rate;
|
||||
double expectedCount = allocationTotal * allocationIterations / rate;
|
||||
|
||||
double error = Math.abs(actualCount - expectedCount);
|
||||
double errorPercentage = error / expectedCount * 100;
|
||||
|
||||
boolean failure = (errorPercentage > 10.0);
|
||||
boolean success = (errorPercentage < 10.0);
|
||||
|
||||
if (failure && throwIfFailure) {
|
||||
if (!success && throwIfFailure) {
|
||||
throw new RuntimeException("Rate average over 10% for rate " + rate + " -> " + actualCount
|
||||
+ ", " + expectedCount);
|
||||
}
|
||||
|
||||
return failure;
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user