8204163: Also detect concurrent GCs in MetaspaceBaseGC.java

Reviewed-by: eosterlund, pliden
This commit is contained in:
Stefan Karlsson 2018-06-05 15:56:12 +02:00
parent a56e3ff761
commit b95d16720f
2 changed files with 16 additions and 25 deletions

View File

@ -187,30 +187,22 @@ public class HighWaterMarkTest extends FirstGCTest {
}
System.out.println("% GC has been invoked: " + gcCount + " times");
if (VMRuntimeEnvUtils.isVMOptionEnabled("UseG1GC") &&
VMRuntimeEnvUtils.isVMOptionEnabled("ClassUnloadingWithConcurrentMark")) {
System.out.println("% isG1ClassUnloading: true");
if (gcCount != 0) {
throw new Fault ("G1 should unload classes, full GC is not expected");
}
if (maxMetaspaceFreeRatio <= 1) {
// min/max = 0/1 boundary value
// GC should happen very often
checkGCCount(gcCount, 20, -1);
} else if (minMetaspaceFreeRatio >= 99) {
// min/max = 99/100 boundary value
// GC should happen very rare
checkGCCount(gcCount, -1, 2);
} else if (minMetaspaceFreeRatio >= 10 && maxMetaspaceFreeRatio <= 20) {
// GC should happen quite often
checkGCCount(gcCount, 3, 30);
} else if (minMetaspaceFreeRatio >= 70 && maxMetaspaceFreeRatio <= 80) {
// GC should happen quite often
checkGCCount(gcCount, 1, 3);
} else {
if (maxMetaspaceFreeRatio <= 1) {
// min/max = 0/1 boundary value
// GC should happen very often
checkGCCount(gcCount, 20, -1);
} else if (minMetaspaceFreeRatio >= 99) {
// min/max = 99/100 boundary value
// GC should happen very rare
checkGCCount(gcCount, -1, 2);
} else if (minMetaspaceFreeRatio >= 10 && maxMetaspaceFreeRatio <= 20) {
// GC should happen quite often
checkGCCount(gcCount, 3, 30);
} else if (minMetaspaceFreeRatio >= 70 && maxMetaspaceFreeRatio <= 80) {
// GC should happen quite often
checkGCCount(gcCount, 1, 3);
} else {
// hard to estimate
}
// hard to estimate
}
}

View File

@ -180,14 +180,13 @@ public abstract class MetaspaceBaseGC {
/**
* Reads gc.log file and counts GC induced by metaspace.
* Note: this method doesn't work for ConcMarkSweep...
* @return how many times GC induced by metaspace has occurred.
*/
protected int getMetaspaceGCCount() {
int count = 0;
try {
for (String line: readGCLog()) {
if (line.indexOf("Pause Full") > 0 && line.indexOf("Meta") > 0) {
if (line.indexOf("Metadata GC ") > 0) {
count++;
}
}