1 /*
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
39 * It will be verified that numerical values have defined types and are reasonable,
40 * for example percentage should fit within 0-100 interval.
41 */
42 public class JstatGCUtilParser {
43
44 public enum GcStatisticsType {
45 INTEGER, DOUBLE, PERCENTAGE, PERCENTAGE_OR_DASH;
46 }
47
48 public enum GcStatistics {
49 S0(GcStatisticsType.PERCENTAGE),
50 S1(GcStatisticsType.PERCENTAGE),
51 E(GcStatisticsType.PERCENTAGE),
52 O(GcStatisticsType.PERCENTAGE),
53 M(GcStatisticsType.PERCENTAGE),
54 CCS(GcStatisticsType.PERCENTAGE_OR_DASH),
55 YGC(GcStatisticsType.INTEGER),
56 YGCT(GcStatisticsType.DOUBLE),
57 FGC(GcStatisticsType.INTEGER),
58 FGCT(GcStatisticsType.DOUBLE),
59 GCT(GcStatisticsType.DOUBLE);
60
61 private final GcStatisticsType type;
62
63 private GcStatistics(GcStatisticsType type) {
64 this.type = type;
65 }
66
67 private GcStatisticsType getType() {
68 return type;
69 }
70
71 public static boolean isHeadline(String... valueArray) {
72 if (valueArray.length != values().length) {
73 return false;
74 }
75 int headersCount = 0;
76 for (int i = 0; i < values().length; i++) {
77 if (valueArray[i].equals(values()[i].toString())) {
78 headersCount++;
|
1 /*
2 * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
39 * It will be verified that numerical values have defined types and are reasonable,
40 * for example percentage should fit within 0-100 interval.
41 */
42 public class JstatGCUtilParser {
43
44 public enum GcStatisticsType {
45 INTEGER, DOUBLE, PERCENTAGE, PERCENTAGE_OR_DASH;
46 }
47
48 public enum GcStatistics {
49 S0(GcStatisticsType.PERCENTAGE),
50 S1(GcStatisticsType.PERCENTAGE),
51 E(GcStatisticsType.PERCENTAGE),
52 O(GcStatisticsType.PERCENTAGE),
53 M(GcStatisticsType.PERCENTAGE),
54 CCS(GcStatisticsType.PERCENTAGE_OR_DASH),
55 YGC(GcStatisticsType.INTEGER),
56 YGCT(GcStatisticsType.DOUBLE),
57 FGC(GcStatisticsType.INTEGER),
58 FGCT(GcStatisticsType.DOUBLE),
59 CGC(GcStatisticsType.INTEGER),
60 CGCT(GcStatisticsType.DOUBLE),
61 GCT(GcStatisticsType.DOUBLE);
62
63 private final GcStatisticsType type;
64
65 private GcStatistics(GcStatisticsType type) {
66 this.type = type;
67 }
68
69 private GcStatisticsType getType() {
70 return type;
71 }
72
73 public static boolean isHeadline(String... valueArray) {
74 if (valueArray.length != values().length) {
75 return false;
76 }
77 int headersCount = 0;
78 for (int i = 0; i < values().length; i++) {
79 if (valueArray[i].equals(values()[i].toString())) {
80 headersCount++;
|