Path: blob/master/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcCauseResults.java
41159 views
/*1* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/*24* Results of running the JstatGcTool ("jstat -gccause <pid>")25*26* Output example:27* S0 S1 E O M CCS YGC YGCT FGC FGCT CGC CGCT GCT LGCC GCC28* 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 GC29*30* Output description:31* S0 Survivor space 0 utilization as a percentage of the space's current capacity.32* S1 Survivor space 1 utilization as a percentage of the space's current capacity.33* E Eden space utilization as a percentage of the space's current capacity.34* O Old space utilization as a percentage of the space's current capacity.35* M Metaspace utilization as a percentage of the space's current capacity.36* CCS Compressed Class Space37* YGC Number of young generation GC events.38* YGCT Young generation garbage collection time.39* FGC Number of full GC events.40* FGCT Full garbage collection time.41* CGC Concurrent Collections (STW phase)42* CGCT Concurrent Garbage Collection Time (STW phase)43* GCT Total garbage collection time.44* LGCC Cause of last Garbage Collection.45* GCC Cause of current Garbage Collection.46*/47package utils;4849import common.ToolResults;5051public class JstatGcCauseResults extends JstatResults {5253public JstatGcCauseResults(ToolResults rawResults) {54super(rawResults);55}5657/**58* Checks the overall consistency of the results reported by the tool59*/60@Override61public void assertConsistency() {6263assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode());6465int YGC = getIntValue("YGC");66float YGCT = getFloatValue("YGCT");67assertThat(YGCT >= 0, "Incorrect time value for YGCT");6869float GCT = getFloatValue("GCT");70assertThat(GCT >= 0, "Incorrect time value for GCT");71assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)");7273int CGC = 0;74float CGCT = 0.0f;75try {76CGC = getIntValue("CGC");77} catch (NumberFormatException e) {78if (!e.getMessage().equals("Unparseable number: \"-\"")) {79throw e;80}81}82if (CGC > 0) {83CGCT = getFloatValue("CGCT");84assertThat(CGCT >= 0, "Incorrect time value for CGCT");85}8687int FGC = getIntValue("FGC");88float FGCT = getFloatValue("FGCT");89assertThat(FGCT >= 0, "Incorrect time value for FGCT");9091assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)");9293assertThat(checkFloatIsSum(GCT, YGCT, CGCT, FGCT), "GCT != (YGCT + CGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT94+ ", CGCT = " + CGCT + ", FGCT = " + FGCT + ", (YCGT + CGCT + FGCT) = " + (YGCT + CGCT + FGCT) + ")");95}96}979899