Fix reporting of 'Permanent Generation' / Metaspace.

Fix regression in last commit. While it added auto-detection of changing
column position it did not take into account the known change from
Java 7 > 8.

Java <8 had the Permanent Generation region which jstat columns PU, PC
While Java >=8 now has a Metaspace region (for similar purpose) with
jstat columns MU,MC.

Add re-add detection for that change to fix reporting of the values.

To simplify code uses the MU,MC labels internally and when MU,MC are
not found in jstat output it fills those with PU,PC values.
This commit is contained in:
Stefan Huehner 2018-12-14 14:43:31 +01:00
parent 4e713c9b30
commit 583560e57f
1 changed files with 5 additions and 0 deletions

View File

@ -124,6 +124,11 @@ print_stats() {
S1F = $idx["S1C"] - $idx["S1U"];
EF = $idx["EC"] - $idx["EU"];
OF = $idx["OC"] - $idx["OU"];
# Java <8 has Permanent Generation (PU,PC columns), while >=8 has/names it Metaspace (MU,MC)
if (idx["MU"] == "") {
idx["MU"] = idx["PU"];
idx["MC"] = idx["PC"];
}
MF = $idx["MC"] - $idx["MU"];
print "Eden_Used.value " $idx["EU"] * 1024;
print "Eden_Free.value " EF * 1024;