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.
Java8.
jstat column output is not stable across JVM versions (technically
version of jstat binary used).
New columns are added not add the end of column list but in the middle
breaking access via constant index.
Following table shows the known columns per version:
Oracle JDK / OpenJDK 1.5 .. 1.7
S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT
Openjdk 1.8 .. 10
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT
Openjdk 11 .. 12
S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT
Earlier commit here added support for java8+ but using version checking
if version == 1.5 > Use pre-java8 column format, else new format.
As fixing java6+7 would mean more version comparison which is ugly this
cmomit changes retrival logic to the following;
a.) Parse first line jstat output to find position for each label
b.) Then use that position to fetch value from 2nd line
That way code auto-adjusts to any ordering change without needing any
java version specific code or checks.
On the way fix 'Permanent Used' value reporting for java8 which was
broken (missing variable rename from PU -> MU when java8 support was
added).