test/hotspot/jtreg/serviceability/tmtools/jstat/utils/JstatGcResults.java
author ysuenaga
Thu, 26 Apr 2018 09:45:47 +0900
changeset 49891 61b0342b5711
parent 49377 ecd91135d645
child 50190 6f548c41a4fc
permissions -rw-r--r--
8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-" Reviewed-by: sjohanss, jgeorge
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
/*
49377
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
     2
 * Copyright (c) 2015, 2018, 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 -gc <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:
49377
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
    28
 * S0C    S1C    S0U    S1U      EC       EU        OC         OU       MC     MU    CCSC   CCSU   YGC     YGCT    FGC    FGCT    CGC    CGCT     GCT
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
    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
35493
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
 * S0C     Current survivor space 0 capacity (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    33
 * S1C     Current survivor space 1 capacity (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    34
 * S0U     Survivor space 0 utilization (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    35
 * S1U     Survivor space 1 utilization (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    36
 * EC      Current eden space capacity (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    37
 * EU      Eden space utilization (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    38
 * OC      Current old space capacity (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    39
 * OU      Old space utilization (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    40
 * MC      Current metaspace capacity (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    41
 * MU      Metaspace utilization (KB).
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    42
 * CCSC    Compressed Class Space capacity
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    43
 * CCSU    Compressed Class Space utilization
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    44
 * YGC     Number of young generation GC Events.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    45
 * YGCT    Young generation garbage collection time.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    46
 * FGC     Number of full GC events.
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    47
 * FGCT    Full garbage collection time.
49377
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
    48
 * CGC     Concurrent Collections (STW phase)
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
    49
 * CGCT    Concurrent Garbage Collection Time (STW phase)
35493
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    50
 * GCT     Total garbage collection time.
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
 */
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    53
package utils;
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
import common.ToolResults;
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
public class JstatGcResults extends JstatResults {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    58
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    59
    public JstatGcResults(ToolResults rawResults) {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    60
        super(rawResults);
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
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
     * 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
    65
     */
43933
85ee551f3948 8170737: Not enough old space utilisation
mchernov
parents: 35493
diff changeset
    66
    @Override
35493
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    67
    public void assertConsistency() {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    68
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    69
        assertThat(getExitCode() == 0, "Unexpected exit code: " + getExitCode());
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 OC = getFloatValue("OC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    72
        float OU = getFloatValue("OU");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    73
        assertThat(OU <= OC, "OU > OC (utilization > capacity)");
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
        float MC = getFloatValue("MC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    76
        float MU = getFloatValue("MU");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    77
        assertThat(MU <= MC, "MU > MC (utilization > capacity)");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    78
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    79
        float CCSC = getFloatValue("CCSC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    80
        float CCSU = getFloatValue("CCSU");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    81
        assertThat(CCSU <= CCSC, "CCSU > CCSC (utilization > capacity)");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    82
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    83
        float S0C = getFloatValue("S0C");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    84
        float S0U = getFloatValue("S0U");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    85
        assertThat(S0U <= S0C, "S0U > S0C (utilization > capacity)");
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
        float S1C = getFloatValue("S1C");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    88
        float S1U = getFloatValue("S1U");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    89
        assertThat(S1U <= S1C, "S1U > S1C (utilization > capacity)");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    90
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    91
        float EC = getFloatValue("EC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    92
        float EU = getFloatValue("EU");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    93
        assertThat(EU <= EC, "EU > EC (utilization > capacity)");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    94
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    95
        int YGC = getIntValue("YGC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    96
        float YGCT = getFloatValue("YGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    97
        assertThat(YGCT >= 0, "Incorrect time value for YGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    98
        if (YGC > 0) {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
    99
            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
   100
        }
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   101
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   102
        float GCT = getFloatValue("GCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   103
        assertThat(GCT >= 0, "Incorrect time value for GCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   104
        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
   105
49891
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   106
        int CGC = 0;
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   107
        float CGCT = 0.0f;
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   108
        try {
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   109
            CGC = getIntValue("CGC");
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   110
        } catch (NumberFormatException e) {
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   111
            if (!e.getMessage().equals("Unparseable number: \"-\"")) {
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   112
                throw e;
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   113
            }
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   114
        }
49377
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
   115
        if (CGC > 0) {
49891
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   116
            CGCT = getFloatValue("CGCT");
61b0342b5711 8199519: Several GC tests fails with: java.lang.NumberFormatException: Unparseable number: "-"
ysuenaga
parents: 49377
diff changeset
   117
            assertThat(CGCT >= 0, "Incorrect time value for CGCT");
49377
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
   118
            assertThat(CGCT > 0, "Number of concurrent GC events is " + CGC + ", but CGCT is 0");
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
   119
        }
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
   120
35493
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   121
        int FGC = getIntValue("FGC");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   122
        float FGCT = getFloatValue("FGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   123
        assertThat(FGCT >= 0, "Incorrect time value for FGCT");
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   124
        if (FGC > 0) {
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   125
            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
   126
        }
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   127
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   128
        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
   129
49377
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
   130
        assertThat(checkFloatIsSum(GCT, YGCT, CGCT, FGCT), "GCT != (YGCT + CGCT + FGCT) " + "(GCT = " + GCT + ", YGCT = " + YGCT
ecd91135d645 8153333: [REDO] STW phases at Concurrent GC should count in PerfCounte
ysuenaga
parents: 47216
diff changeset
   131
                + ", CGCT = " + CGCT + ", FGCT = " + FGCT + ", (YCGT + CGCT + FGCT) = " + (YGCT + CGCT + FGCT) + ")");
35493
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   132
    }
863fb33f9940 8130063: Refactoring tmtools jstat and jstack tests to jtreg
akulyakh
parents:
diff changeset
   133
}