test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlG1.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 46384 hotspot/test/gc/concurrent_phase_control/TestConcurrentPhaseControlG1.java@dacebddcdea0
child 48791 6e079ff6c83c
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
46384
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     1
/*
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     2
 * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     4
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     7
 * published by the Free Software Foundation.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     8
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    13
 * accompanied this code).
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    14
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    18
 *
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    21
 * questions.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    22
 */
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    23
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    24
/*
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    25
 * @test TestConcurrentPhaseControlG1
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    26
 * @bug 8169517
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    27
 * @requires vm.gc.G1
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    28
 * @summary Test of WhiteBox concurrent GC phase control for G1.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    29
 * @key gc
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    30
 * @modules java.base
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    31
 * @library /test/lib /
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    32
 * @build sun.hotspot.WhiteBox
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    33
 * @run main ClassFileInstaller sun.hotspot.WhiteBox
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    34
 *    sun.hotspot.WhiteBox$WhiteBoxPermission
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    35
 * @run driver TestConcurrentPhaseControlG1
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    36
 */
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    37
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    38
import gc.concurrent_phase_control.CheckControl;
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    39
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    40
public class TestConcurrentPhaseControlG1 {
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    41
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    42
    // Pairs of phase name and regex to match log stringm for stepping through,
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    43
    private static final String[][] g1PhaseInfo = {
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    44
        // Step through the phases in order.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    45
        {"IDLE", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    46
        {"CONCURRENT_CYCLE", "Concurrent Cycle"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    47
        {"IDLE", null},  // Resume IDLE before testing subphases
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    48
        {"CLEAR_CLAIMED_MARKS", "Concurrent Clear Claimed Marks"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    49
        {"SCAN_ROOT_REGIONS", "Concurrent Scan Root Regions"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    50
        // ^F so not "From Roots", ^R so not "Restart"
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    51
        {"CONCURRENT_MARK", "Concurrent Mark [^FR]"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    52
        {"IDLE", null},  // Resume IDLE before testing subphases
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    53
        {"MARK_FROM_ROOTS", "Concurrent Mark From Roots"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    54
        {"BEFORE_REMARK", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    55
        {"REMARK", "Pause Remark"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    56
        {"CREATE_LIVE_DATA", "Concurrent Create Live Data"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    57
        // "COMPLETE_CLEANUP",  -- optional phase, not reached by this test
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    58
        {"CLEANUP_FOR_NEXT_MARK", "Concurrent Cleanup for Next Mark"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    59
        // Clear request
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    60
        {"IDLE", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    61
        {"ANY", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    62
        // Request a phase.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    63
        {"MARK_FROM_ROOTS", "Concurrent Mark From Roots"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    64
        // Request an earlier phase, to ensure loop rather than stuck at idle.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    65
        {"SCAN_ROOT_REGIONS", "Concurrent Scan Root Regions"},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    66
        // Clear request, to unblock service.
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    67
        {"IDLE", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    68
        {"ANY", null},
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    69
    };
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    70
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    71
    private static final String[] g1Options =
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    72
        new String[]{"-XX:+UseG1GC",  "-Xlog:gc,gc+marking"};
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    73
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    74
    private static final String g1Name = "G1";
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    75
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    76
    public static void main(String[] args) throws Exception {
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    77
        CheckControl.check(g1Name, g1Options, g1PhaseInfo);
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    78
    }
dacebddcdea0 8169517: WhiteBox should provide concurrent GC phase control
kbarrett
parents:
diff changeset
    79
}