1 /* 2 * Copyright (c) 2015, 2017, 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 -gc <pid>") 26 * 27 * Output example: 28 * (S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT GCT 29 * 512.0 512.0 32.0 0.0 288768.0 168160.6 83968.0 288.1 4864.0 2820.3 512.0 279.7 18510 1559.208 0 0.000 1559.208 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 * EC Current eden space capacity (KB). 37 * EU Eden space utilization (KB). 38 * OC Current old space capacity (KB). 39 * OU Old space utilization (KB). 40 * MC Current metaspace capacity (KB). 41 * MU Metaspace utilization (KB). 42 * CCSC Compressed Class Space capacity 43 * CCSU Compressed Class Space utilization 44 * YGC Number of young generation GC Events. 45 * YGCT Young generation garbage collection time. 46 * FGC Number of full GC events. 47 * FGCT Full garbage collection time. 48 * GCT Total garbage collection time. 49 * 50 */ 51 package utils; 52 53 import common.ToolResults; 54 55 public class JstatGcResults extends JstatResults { 56 57 public JstatGcResults(ToolResults rawResults) { 58 super(rawResults); 59 } 60 61 /** 62 * Checks the overall consistency of the results reported by the tool 63 */ 64 @Override 65 public void assertConsistency() { 66 67 assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode()); 84 85 float S1C = getFloatValue("S1C"); 86 float S1U = getFloatValue("S1U"); 87 assertThat(S1U <= S1C, "S1U > S1C (utilization > capacity)"); 88 89 float EC = getFloatValue("EC"); 90 float EU = getFloatValue("EU"); 91 assertThat(EU <= EC, "EU > EC (utilization > capacity)"); 92 93 int YGC = getIntValue("YGC"); 94 float YGCT = getFloatValue("YGCT"); 95 assertThat(YGCT >= 0, "Incorrect time value for YGCT"); 96 if (YGC > 0) { 97 assertThat(YGCT > 0, "Number of young generation GC Events is " + YGC + ", but YGCT is 0"); 98 } 99 100 float GCT = getFloatValue("GCT"); 101 assertThat(GCT >= 0, "Incorrect time value for GCT"); 102 assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)"); 103 104 int FGC = getIntValue("FGC"); 105 float FGCT = getFloatValue("FGCT"); 106 assertThat(FGCT >= 0, "Incorrect time value for FGCT"); 107 if (FGC > 0) { 108 assertThat(FGCT > 0, "Number of full GC events is " + FGC + ", but FGCT is 0"); 109 } 110 111 assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)"); 112 113 assertThat(checkFloatIsSum(GCT, YGCT, FGCT), "GCT != (YGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT 114 + ", FGCT = " + FGCT + ", (YCGT + FGCT) = " + (YGCT + FGCT) + ")"); 115 } 116 } | 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 -gc <pid>") 26 * 27 * Output example: 28 * S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT 29 * 512.0 512.0 32.0 0.0 288768.0 168160.6 83968.0 288.1 4864.0 2820.3 512.0 279.7 18510 1559.208 0 0.000 0 0.0 1559.208 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 * EC Current eden space capacity (KB). 37 * EU Eden space utilization (KB). 38 * OC Current old space capacity (KB). 39 * OU Old space utilization (KB). 40 * MC Current metaspace capacity (KB). 41 * MU Metaspace utilization (KB). 42 * CCSC Compressed Class Space capacity 43 * CCSU Compressed Class Space utilization 44 * YGC Number of young generation GC Events. 45 * YGCT Young generation garbage collection time. 46 * FGC Number of full GC events. 47 * FGCT Full garbage collection time. 48 * CGC Concurrent Collections (STW phase) 49 * CGCT Concurrent Garbage Collection Time (STW phase) 50 * GCT Total garbage collection time. 51 * 52 */ 53 package utils; 54 55 import common.ToolResults; 56 57 public class JstatGcResults extends JstatResults { 58 59 public JstatGcResults(ToolResults rawResults) { 60 super(rawResults); 61 } 62 63 /** 64 * Checks the overall consistency of the results reported by the tool 65 */ 66 @Override 67 public void assertConsistency() { 68 69 assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode()); 86 87 float S1C = getFloatValue("S1C"); 88 float S1U = getFloatValue("S1U"); 89 assertThat(S1U <= S1C, "S1U > S1C (utilization > capacity)"); 90 91 float EC = getFloatValue("EC"); 92 float EU = getFloatValue("EU"); 93 assertThat(EU <= EC, "EU > EC (utilization > capacity)"); 94 95 int YGC = getIntValue("YGC"); 96 float YGCT = getFloatValue("YGCT"); 97 assertThat(YGCT >= 0, "Incorrect time value for YGCT"); 98 if (YGC > 0) { 99 assertThat(YGCT > 0, "Number of young generation GC Events is " + YGC + ", but YGCT is 0"); 100 } 101 102 float GCT = getFloatValue("GCT"); 103 assertThat(GCT >= 0, "Incorrect time value for GCT"); 104 assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)"); 105 106 int CGC = getIntValue("CGC"); 107 float CGCT = getFloatValue("CGCT"); 108 assertThat(CGCT >= 0, "Incorrect time value for CGCT"); 109 if (CGC > 0) { 110 assertThat(CGCT > 0, "Number of concurrent GC events is " + CGC + ", but CGCT is 0"); 111 } 112 113 int FGC = getIntValue("FGC"); 114 float FGCT = getFloatValue("FGCT"); 115 assertThat(FGCT >= 0, "Incorrect time value for FGCT"); 116 if (FGC > 0) { 117 assertThat(FGCT > 0, "Number of full GC events is " + FGC + ", but FGCT is 0"); 118 } 119 120 assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)"); 121 122 assertThat(checkFloatIsSum(GCT, YGCT, CGCT, FGCT), "GCT != (YGCT + CGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT 123 + ", CGCT = " + CGCT + ", FGCT = " + FGCT + ", (YCGT + CGCT + FGCT) = " + (YGCT + CGCT + FGCT) + ")"); 124 } 125 } |