hotspot/test/serviceability/tmtools/jstat/utils/JstatGcCauseResults.java
author mchernov
Fri, 03 Feb 2017 15:45:57 +0300
changeset 43933 85ee551f3948
parent 35493 863fb33f9940
permissions -rw-r--r--
8170737: Not enough old space utilisation Reviewed-by: dfazunen, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35493
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     1
/*
43933
85ee551f3948 8170737: Not enough old space utilisation
mchernov
parents: 35493
diff changeset
     2
 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
35493
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     4
 *
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     7
 * published by the Free Software Foundation.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     8
 *
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    13
 * accompanied this code).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    14
 *
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    18
 *
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    21
 * questions.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    22
 */
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    23
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    24
/*
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    25
 * Results of running the JstatGcTool ("jstat -gccause <pid>")
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    26
 *
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    27
 * Output example:
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    28
 * S0     S1     E      O      M     CCS    YGC     YGCT    FGC    FGCT     GCT    LGCC                 GCC
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    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
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    30
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    31
 * Output description:
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    32
 * S0         Survivor space 0 utilization as a percentage of the space's current capacity.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    33
 * S1         Survivor space 1 utilization as a percentage of the space's current capacity.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    34
 * E           Eden space utilization as a percentage of the space's current capacity.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    35
 * O           Old space utilization as a percentage of the space's current capacity.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    36
 * M          Metaspace utilization as a percentage of the space's current capacity.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    37
 * CCS     Compressed Class Space
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    38
 * YGC     Number of young generation GC events.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    39
 * YGCT    Young generation garbage collection time.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    40
 * FGC      Number of full GC events.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    41
 * FGCT    Full garbage collection time.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    42
 * GCT      Total garbage collection time.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    43
 * LGCC    Cause of last Garbage Collection.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    44
 * GCC      Cause of current Garbage Collection.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    45
 */
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    46
package utils;
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    47
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    48
import common.ToolResults;
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    49
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    50
public class JstatGcCauseResults extends JstatResults {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    51
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    52
    public JstatGcCauseResults(ToolResults rawResults) {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    53
        super(rawResults);
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    54
    }
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    55
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    56
    /**
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    57
     * Checks the overall consistency of the results reported by the tool
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    58
     */
43933
85ee551f3948 8170737: Not enough old space utilisation
mchernov
parents: 35493
diff changeset
    59
    @Override
35493
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    60
    public void assertConsistency() {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    61
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    62
        assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode());
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    63
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    64
        int YGC = getIntValue("YGC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    65
        float YGCT = getFloatValue("YGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    66
        assertThat(YGCT >= 0, "Incorrect time value for YGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    67
        if (YGC > 0) {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    68
            assertThat(YGCT > 0, "Number of young generation GC Events is " + YGC + ", but YGCT is 0");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    69
        }
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    70
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    71
        float GCT = getFloatValue("GCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    72
        assertThat(GCT >= 0, "Incorrect time value for GCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    73
        assertThat(GCT >= YGCT, "GCT < YGCT (total garbage collection time < young generation garbage collection time)");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    74
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    75
        int FGC = getIntValue("FGC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    76
        float FGCT = getFloatValue("FGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    77
        assertThat(FGCT >= 0, "Incorrect time value for FGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    78
        if (FGC > 0) {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    79
            assertThat(FGCT > 0, "Number of full GC events is " + FGC + ", but FGCT is 0");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    80
        }
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    81
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    82
        assertThat(GCT >= FGCT, "GCT < YGCT (total garbage collection time < full generation garbage collection time)");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    83
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    84
        assertThat(checkFloatIsSum(GCT, YGCT, FGCT), "GCT != (YGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    85
                + ", FGCT = " + FGCT + ", (YCGT + FGCT) = " + (YGCT + FGCT) + ")");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    86
    }
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    87
}