< prev index next >
test/compiler/codecache/jmx/GetUsageTest.java
Print this page
*** 50,66 ****
this.allocateSize = allocSize;
}
public static void main(String[] args) throws Exception {
for (BlobType btype : BlobType.getAvailable()) {
- if (CodeCacheUtils.isCodeHeapPredictable(btype)) {
for (int allocSize = 10; allocSize < 100000; allocSize *= 10) {
new GetUsageTest(btype, allocSize).runTest();
}
}
}
- }
protected final Map<MemoryPoolMXBean, Long> getBeanUsages() {
Map<MemoryPoolMXBean, Long> beanUsages = new HashMap<>();
for (BlobType bt : BlobType.getAvailable()) {
beanUsages.put(bt.getMemoryPool(),
--- 50,64 ----
*** 85,101 ****
long usageUpperEstimate = Math.max(blockCount,
CodeCacheUtils.MIN_BLOCK_LENGTH) * CodeCacheUtils.SEGMENT_SIZE;
for (MemoryPoolMXBean entry : predictableBeans) {
long diff = current.get(entry) - initial.get(entry);
if (entry.equals(btype.getMemoryPool())) {
Asserts.assertFalse(diff <= 0L || diff > usageUpperEstimate,
String.format("Pool %s usage increase was reported "
+ "unexpectedly as increased by %d using "
+ "allocation size %d", entry.getName(),
diff, allocateSize));
} else {
! Asserts.assertEQ(diff, 0L,
String.format("Pool %s usage changed unexpectedly while"
+ " trying to increase: %s using allocation "
+ "size %d", entry.getName(),
btype.getMemoryPool().getName(), allocateSize));
}
--- 83,101 ----
long usageUpperEstimate = Math.max(blockCount,
CodeCacheUtils.MIN_BLOCK_LENGTH) * CodeCacheUtils.SEGMENT_SIZE;
for (MemoryPoolMXBean entry : predictableBeans) {
long diff = current.get(entry) - initial.get(entry);
if (entry.equals(btype.getMemoryPool())) {
+ if (CodeCacheUtils.isCodeHeapPredictable(btype)) {
Asserts.assertFalse(diff <= 0L || diff > usageUpperEstimate,
String.format("Pool %s usage increase was reported "
+ "unexpectedly as increased by %d using "
+ "allocation size %d", entry.getName(),
diff, allocateSize));
+ }
} else {
! CodeCacheUtils.assertEQorGTE(btype, diff, 0L,
String.format("Pool %s usage changed unexpectedly while"
+ " trying to increase: %s using allocation "
+ "size %d", entry.getName(),
btype.getMemoryPool().getName(), allocateSize));
}
< prev index next >