hotspot/test/gc/g1/plab/lib/PLABUtils.java
author mchernov
Mon, 08 Feb 2016 18:54:09 +0300
changeset 35947 48c797584ac2
parent 35885 6e62be7db2c8
child 38726 2c99beca1dd8
permissions -rw-r--r--
8148745: [testbug] Test gc/g1/plab/TestPLABPromotion.java fails in nightly Reviewed-by: tschatzl, dfazunen
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
35885
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     1
/*
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     4
 *
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     7
 * published by the Free Software Foundation.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     8
 *
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    13
 * accompanied this code).
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    14
 *
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    18
 *
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    21
 * questions.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    22
 */
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    23
package gc.g1.plab.lib;
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    24
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    25
import java.util.ArrayList;
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    26
import java.util.Arrays;
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    27
import java.util.Collections;
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    28
import java.util.List;
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    29
import jdk.test.lib.Utils;
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    30
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    31
/**
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    32
 * Utilities for PLAB testing.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    33
 */
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    34
public class PLABUtils {
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    35
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    36
    /**
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    37
     * PLAB tests default options list
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    38
     */
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    39
    private final static String[] GC_TUNE_OPTIONS = {
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    40
        "-XX:+UseG1GC",
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    41
        "-XX:G1HeapRegionSize=1m",
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    42
        "-XX:OldSize=64m",
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    43
        "-XX:-UseAdaptiveSizePolicy",
35947
48c797584ac2 8148745: [testbug] Test gc/g1/plab/TestPLABPromotion.java fails in nightly
mchernov
parents: 35885
diff changeset
    44
        "-XX:MaxTenuringThreshold=1",
35885
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    45
        "-XX:-UseTLAB",
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    46
        "-XX:SurvivorRatio=1"
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    47
    };
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    48
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    49
    /**
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    50
     * GC logging options list.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    51
     */
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    52
    private final static String G1_PLAB_LOGGING_OPTIONS[] = {
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    53
        "-Xlog:gc=debug,gc+plab=debug"
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    54
    };
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    55
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    56
    /**
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    57
     * List of options required to use WhiteBox.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    58
     */
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    59
    private final static String WB_DIAGNOSTIC_OPTIONS[] = {
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    60
        "-Xbootclasspath/a:.",
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    61
        "-XX:+UnlockDiagnosticVMOptions",
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    62
        "-XX:+WhiteBoxAPI"
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    63
    };
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    64
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    65
    /**
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    66
     * Prepares options for testing.
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    67
     *
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    68
     * @param options - additional options for testing
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    69
     * @return List of options
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    70
     */
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    71
    public static List<String> prepareOptions(List<String> options) {
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    72
        if (options == null) {
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    73
            throw new IllegalArgumentException("Options cannot be null");
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    74
        }
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    75
        List<String> executionOtions = new ArrayList<>(
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    76
                Arrays.asList(Utils.getTestJavaOpts())
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    77
        );
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    78
        Collections.addAll(executionOtions, WB_DIAGNOSTIC_OPTIONS);
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    79
        Collections.addAll(executionOtions, G1_PLAB_LOGGING_OPTIONS);
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    80
        Collections.addAll(executionOtions, GC_TUNE_OPTIONS);
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    81
        executionOtions.addAll(options);
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    82
        return executionOtions;
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    83
    }
6e62be7db2c8 8141278: New tests for PLAB testing
mchernov
parents:
diff changeset
    84
}