// Test case: // IHOP value, heap occupancy, heap size, expectation of message // Test cases for occupancy is greater than IHOP
runTest(30, 35, 64, true);
runTest(50, 55, 256, true);
runTest(60, 65, 64, true);
runTest(70, 75, 512, true);
// Test cases for big difference between occupancy and IHOP
runTest(30, 50, 256, true);
runTest(30, 70, 512, true);
runTest(50, 70, 256, true);
// Test cases for occupancy is less than IHOP
runTest(30, 25, 64, false);
runTest(50, 45, 256, false);
runTest(70, 65, 64, false);
runTest(70, 65, 512, false);
// Test cases for big difference between occupancy and IHOP
runTest(50, 30, 300, false);
runTest(70, 50, 160, false);
// Concurrent cycle was not initiated but was expected. if (logItems.isEmpty() && expectInitiationMessage) {
System.out.println(out.getOutput()); thrownew RuntimeException("Concurrent cycle was not initiated.");
}
IhopUtils.checkIhopLogValues(out);
}
// Calculate part of heap to be filled to achieve expected occupancy.
System.out.println("Mem to fill:" + MEMORY_TO_FILL); if (MEMORY_TO_FILL <= 0) { thrownew RuntimeException("Wrong memory size: " + MEMORY_TO_FILL);
} try {
createGarbage(MEMORY_TO_FILL);
} catch (OutOfMemoryError oome) { return;
} // Concurrent cycle initiation should start at end of Young GC cycle. // Will fill entire young gen with garbage to guarantee that Young GC was initiated. try {
createGarbage(TestIHOPStatic.YOUNG_SIZE);
} catch (OutOfMemoryError oome) {
}
}
privatestaticvoid createGarbage(long memToFill) { for (long i = 0; i < memToFill / CHUNK_SIZE; i++) {
STORAGE.add(newbyte[CHUNK_SIZE]);
}
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.