< prev index next >

test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcCauseResults.java

Print this page


   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 -gccause <pid>")
  26  *
  27  * Output example:
  28  * S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC
  29  * 0.00   6.25  46.19   0.34  57.98  54.63  15305 1270.551     0    0.000 1270.551 Allocation Failure   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  * GCT      Total garbage collection time.
  43  * LGCC    Cause of last Garbage Collection.
  44  * GCC      Cause of current Garbage Collection.
  45  */
  46 package utils;
  47 
  48 import common.ToolResults;
  49 
  50 public class JstatGcCauseResults extends JstatResults {
  51 
  52     public JstatGcCauseResults(ToolResults rawResults) {
  53         super(rawResults);
  54     }
  55 
  56     /**
  57      * Checks the overall consistency of the results reported by the tool
  58      */
  59     @Override
  60     public void assertConsistency() {
  61 
  62         assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode());
  63 
  64         int YGC = getIntValue("YGC");
  65         float YGCT = getFloatValue("YGCT");
  66         assertThat(YGCT >= 0, "Incorrect time value for YGCT");
  67         if (YGC > 0) {
  68             assertThat(YGCT > 0, "Number of young generation GC Events is " + YGC + ", but YGCT is 0");
  69         }
  70 
  71         float GCT = getFloatValue("GCT");
  72         assertThat(GCT >= 0, "Incorrect time value for GCT");
  73         assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)");
  74 







  75         int FGC = getIntValue("FGC");
  76         float FGCT = getFloatValue("FGCT");
  77         assertThat(FGCT >= 0, "Incorrect time value for FGCT");
  78         if (FGC > 0) {
  79             assertThat(FGCT > 0, "Number of full GC events is " + FGC + ", but FGCT is 0");
  80         }
  81 
  82         assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)");
  83 
  84         assertThat(checkFloatIsSum(GCT, YGCT, FGCT), "GCT != (YGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT
  85                 + ", FGCT = " + FGCT + ", (YCGT + FGCT) = " + (YGCT + FGCT) + ")");
  86     }
  87 }
   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   6.25  46.19   0.34  57.98  54.63  15305 1270.551     0    0.000     0    0.00  1270.551 Allocation Failure   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         if (YGC > 0) {
  70             assertThat(YGCT > 0, "Number of young generation GC Events is " + YGC + ", but YGCT is 0");
  71         }
  72 
  73         float GCT = getFloatValue("GCT");
  74         assertThat(GCT >= 0, "Incorrect time value for GCT");
  75         assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)");
  76 
  77         int CGC = getIntValue("CGC");
  78         float CGCT = getFloatValue("CGCT");
  79         assertThat(CGCT >= 0, "Incorrect time value for CGCT");
  80         if (CGC > 0) {
  81             assertThat(CGCT > 0, "Number of concurrent GC events is " + CGC + ", but CGCT is 0");
  82         }
  83 
  84         int FGC = getIntValue("FGC");
  85         float FGCT = getFloatValue("FGCT");
  86         assertThat(FGCT >= 0, "Incorrect time value for FGCT");
  87         if (FGC > 0) {
  88             assertThat(FGCT > 0, "Number of full GC events is " + FGC + ", but FGCT is 0");
  89         }
  90 
  91         assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)");
  92 
  93         assertThat(checkFloatIsSum(GCT, YGCT, CGCT, FGCT), "GCT != (YGCT + CGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT
  94                 + ", CGCT = " + CGCT + ", FGCT = " + FGCT + ", (YCGT + CGCT + FGCT) = " + (YGCT + CGCT + FGCT) + ")");
  95     }
  96 }
< prev index next >