Path: blob/master/test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcResults.java
41159 views
/*1* Copyright (c) 2015, 2020, 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 -gc <pid>")25*26* Output example:27* S0C S1C S0U S1U EC EU OC OU MC MU CCSC CCSU YGC YGCT FGC FGCT CGC CGCT GCT28* 0.0 2048.0 0.0 1079.5 4096.0 0.0 2048.0 0.0 7680.0 7378.6 768.0 664.7 4 0.140 0 0.000 0 0.000 0.14029*30* Output description:31* S0C Current survivor space 0 capacity (KB).32* S1C Current survivor space 1 capacity (KB).33* S0U Survivor space 0 utilization (KB).34* S1U Survivor space 1 utilization (KB).35* EC Current eden space capacity (KB).36* EU Eden space utilization (KB).37* OC Current old space capacity (KB).38* OU Old space utilization (KB).39* MC Current metaspace capacity (KB).40* MU Metaspace utilization (KB).41* CCSC Compressed Class Space capacity42* CCSU Compressed Class Space utilization43* YGC Number of young generation GC Events.44* YGCT Young generation garbage collection time.45* FGC Number of full GC events.46* FGCT Full garbage collection time.47* CGC Concurrent Collections (STW phase)48* CGCT Concurrent Garbage Collection Time (STW phase)49* GCT Total garbage collection time.50*51*/52package utils;5354import common.ToolResults;5556public class JstatGcResults extends JstatResults {5758public JstatGcResults(ToolResults rawResults) {59super(rawResults);60}6162/**63* Checks the overall consistency of the results reported by the tool64*/65@Override66public void assertConsistency() {6768assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode());6970float OC = getFloatValue("OC");71float OU = getFloatValue("OU");72assertThat(OU <= OC, "OU > OC (utilization > capacity)");7374float MC = getFloatValue("MC");75float MU = getFloatValue("MU");76assertThat(MU <= MC, "MU > MC (utilization > capacity)");7778float CCSC = getFloatValue("CCSC");79float CCSU = getFloatValue("CCSU");80assertThat(CCSU <= CCSC, "CCSU > CCSC (utilization > capacity)");8182float S0C = getFloatValue("S0C");83float S0U = getFloatValue("S0U");84assertThat(S0U <= S0C, "S0U > S0C (utilization > capacity)");8586float S1C = getFloatValue("S1C");87float S1U = getFloatValue("S1U");88assertThat(S1U <= S1C, "S1U > S1C (utilization > capacity)");8990float EC = getFloatValue("EC");91float EU = getFloatValue("EU");92assertThat(EU <= EC, "EU > EC (utilization > capacity)");9394int YGC = getIntValue("YGC");95float YGCT = getFloatValue("YGCT");96assertThat(YGCT >= 0, "Incorrect time value for YGCT");9798float GCT = getFloatValue("GCT");99assertThat(GCT >= 0, "Incorrect time value for GCT");100assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)");101102int CGC = 0;103float CGCT = 0.0f;104try {105CGC = getIntValue("CGC");106} catch (NumberFormatException e) {107if (!e.getMessage().equals("Unparseable number: \"-\"")) {108throw e;109}110}111if (CGC > 0) {112CGCT = getFloatValue("CGCT");113assertThat(CGCT >= 0, "Incorrect time value for CGCT");114}115116int FGC = getIntValue("FGC");117float FGCT = getFloatValue("FGCT");118assertThat(FGCT >= 0, "Incorrect time value for FGCT");119120assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)");121122assertThat(checkFloatIsSum(GCT, YGCT, CGCT, FGCT), "GCT != (YGCT + CGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT123+ ", CGCT = " + CGCT + ", FGCT = " + FGCT + ", (YCGT + CGCT + FGCT) = " + (YGCT + CGCT + FGCT) + ")");124}125}126127128