Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcCauseResults.java
41159 views
1
/*
2
* Copyright (c) 2015, 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
*/
23
24
/*
25
* Results of running the JstatGcTool ("jstat -gccause <pid>")
26
*
27
* Output example:
28
* S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC
29
* 0.00 0.00 0.00 53.70 97.40 92.67 4 0.286 19 17.890 2 0.086 18.263 System.gc() No GC
30
*
31
* Output description:
32
* S0 Survivor space 0 utilization as a percentage of the space's current capacity.
33
* S1 Survivor space 1 utilization as a percentage of the space's current capacity.
34
* E Eden space utilization as a percentage of the space's current capacity.
35
* O Old space utilization as a percentage of the space's current capacity.
36
* M Metaspace utilization as a percentage of the space's current capacity.
37
* CCS Compressed Class Space
38
* YGC Number of young generation GC events.
39
* YGCT Young generation garbage collection time.
40
* FGC Number of full GC events.
41
* FGCT Full garbage collection time.
42
* CGC Concurrent Collections (STW phase)
43
* CGCT Concurrent Garbage Collection Time (STW phase)
44
* GCT Total garbage collection time.
45
* LGCC Cause of last Garbage Collection.
46
* GCC Cause of current Garbage Collection.
47
*/
48
package utils;
49
50
import common.ToolResults;
51
52
public class JstatGcCauseResults extends JstatResults {
53
54
public JstatGcCauseResults(ToolResults rawResults) {
55
super(rawResults);
56
}
57
58
/**
59
* Checks the overall consistency of the results reported by the tool
60
*/
61
@Override
62
public void assertConsistency() {
63
64
assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode());
65
66
int YGC = getIntValue("YGC");
67
float YGCT = getFloatValue("YGCT");
68
assertThat(YGCT >= 0, "Incorrect time value for YGCT");
69
70
float GCT = getFloatValue("GCT");
71
assertThat(GCT >= 0, "Incorrect time value for GCT");
72
assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)");
73
74
int CGC = 0;
75
float CGCT = 0.0f;
76
try {
77
CGC = getIntValue("CGC");
78
} catch (NumberFormatException e) {
79
if (!e.getMessage().equals("Unparseable number: \"-\"")) {
80
throw e;
81
}
82
}
83
if (CGC > 0) {
84
CGCT = getFloatValue("CGCT");
85
assertThat(CGCT >= 0, "Incorrect time value for CGCT");
86
}
87
88
int FGC = getIntValue("FGC");
89
float FGCT = getFloatValue("FGCT");
90
assertThat(FGCT >= 0, "Incorrect time value for FGCT");
91
92
assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)");
93
94
assertThat(checkFloatIsSum(GCT, YGCT, CGCT, FGCT), "GCT != (YGCT + CGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT
95
+ ", CGCT = " + CGCT + ", FGCT = " + FGCT + ", (YCGT + CGCT + FGCT) = " + (YGCT + CGCT + FGCT) + ")");
96
}
97
}
98
99