|
1 /* |
|
2 * Copyright (c) 2015, 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 -gcnew <pid>") |
|
26 * |
|
27 * Output example: |
|
28 * S0C S1C S0U S1U TT MTT DSS EC EU YGC YGCT |
|
29 * 11264.0 11264.0 0.0 0.0 15 15 0.0 67584.0 1351.7 0 0.000 |
|
30 |
|
31 * Output description: |
|
32 * S0C Current survivor space 0 capacity (KB). |
|
33 * S1C Current survivor space 1 capacity (KB). |
|
34 * S0U Survivor space 0 utilization (KB). |
|
35 * S1U Survivor space 1 utilization (KB). |
|
36 * TT Tenuring threshold. |
|
37 * MTT Maximum tenuring threshold. |
|
38 * DSS Desired survivor size (KB). |
|
39 * EC Current eden space capacity (KB). |
|
40 * EU Eden space utilization (KB). |
|
41 * YGC Number of young generation GC events. |
|
42 * YGCT Young generation garbage collection time. |
|
43 */ |
|
44 package utils; |
|
45 |
|
46 import common.ToolResults; |
|
47 |
|
48 public class JstatGcNewResults extends JstatResults { |
|
49 |
|
50 public JstatGcNewResults(ToolResults rawResults) { |
|
51 super(rawResults); |
|
52 } |
|
53 |
|
54 /** |
|
55 * Checks the overall consistency of the results reported by the tool |
|
56 */ |
|
57 public void assertConsistency() { |
|
58 |
|
59 assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode()); |
|
60 |
|
61 float S0C = getFloatValue("S0C"); |
|
62 float S0U = getFloatValue("S0U"); |
|
63 |
|
64 assertThat(S0U <= S0C, "S0U > S0C (utilization > capacity)"); |
|
65 |
|
66 float S1C = getFloatValue("S1C"); |
|
67 float S1U = getFloatValue("S1U"); |
|
68 |
|
69 assertThat(S1U <= S1C, "S1U > S1C (utilization > capacity)"); |
|
70 |
|
71 float EC = getFloatValue("EC"); |
|
72 float EU = getFloatValue("EU"); |
|
73 |
|
74 assertThat(EU <= EC, "EU > EC (utilization > capacity)"); |
|
75 |
|
76 int YGC = getIntValue("YGC"); |
|
77 float YGCT = getFloatValue("YGCT"); |
|
78 |
|
79 if (YGC > 0) { |
|
80 assertThat(YGCT > 0, "Number of young generation GC Events is " + YGC + ", but YGCT is 0"); |
|
81 } |
|
82 |
|
83 int TT = getIntValue("TT"); |
|
84 int MTT = getIntValue("MTT"); |
|
85 assertThat(TT <= MTT, "TT > MTT (tenuring threshold > maximum tenuring threshold)"); |
|
86 } |
|
87 |
|
88 private void assertThat(boolean b, String message) { |
|
89 if (!b) { |
|
90 throw new RuntimeException(message); |
|
91 } |
|
92 } |
|
93 } |