test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java
author lkorinth
Mon, 28 Jan 2019 15:53:56 +0100
changeset 53523 4c5184c56dc2
parent 47216 71c04702a3d5
child 53788 9e7e9506bee2
permissions -rw-r--r--
8214799: Add package declaration to each JTREG test case in the gc folder Reviewed-by: lmesnik, tschatzl
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     1
/*
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 47216
diff changeset
     2
 * Copyright (c) 2013, 2019, Oracle and/or its affiliates. All rights reserved.
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     4
 *
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     7
 * published by the Free Software Foundation.
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     8
 *
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    13
 * accompanied this code).
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    14
 *
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    18
 *
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    21
 * questions.
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    22
 */
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    23
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 47216
diff changeset
    24
package gc.g1;
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 47216
diff changeset
    25
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    26
/*
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    27
 * @test TestRemsetLoggingThreads
39414
4adf52148100 8160088: update hotspot tests depending on GC to use @requires vm.gc.X
dfazunen
parents: 36851
diff changeset
    28
 * @requires vm.gc.G1
35189
a69874af6697 8145534: TestRemsetLogging.java takes a long time
tschatzl
parents: 35061
diff changeset
    29
 * @bug 8025441 8145534
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    30
 * @key gc
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 39414
diff changeset
    31
 * @library /test/lib
36851
03e2f4d0a421 8153737: Unsupported Module
chegar
parents: 35189
diff changeset
    32
 * @modules java.base/jdk.internal.misc
29678
dd2f3932c21e 8075586: Add @modules as needed to the open hotspot tests
ykantser
parents: 27153
diff changeset
    33
 *          java.management/sun.management
35189
a69874af6697 8145534: TestRemsetLogging.java takes a long time
tschatzl
parents: 35061
diff changeset
    34
 * @summary Ensure that various values of worker threads/concurrent
a69874af6697 8145534: TestRemsetLogging.java takes a long time
tschatzl
parents: 35061
diff changeset
    35
 * refinement threads do not crash the VM.
53523
4c5184c56dc2 8214799: Add package declaration to each JTREG test case in the gc folder
lkorinth
parents: 47216
diff changeset
    36
 * @run main gc.g1.TestRemsetLoggingThreads
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    37
 */
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    38
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    39
import java.util.regex.Matcher;
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    40
import java.util.regex.Pattern;
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    41
40631
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 39414
diff changeset
    42
import jdk.test.lib.process.OutputAnalyzer;
ed82623d7831 8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents: 39414
diff changeset
    43
import jdk.test.lib.process.ProcessTools;
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    44
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    45
public class TestRemsetLoggingThreads {
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    46
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    47
  private static void runTest(int refinementThreads, int workerThreads) throws Exception {
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    48
    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    49
                                                              "-XX:+UnlockDiagnosticVMOptions",
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    50
                                                              "-Xlog:gc+remset+exit=trace",
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    51
                                                              "-XX:G1ConcRefinementThreads=" + refinementThreads,
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    52
                                                              "-XX:ParallelGCThreads=" + workerThreads,
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    53
                                                              "-version");
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    54
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    55
    OutputAnalyzer output = new OutputAnalyzer(pb.start());
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    56
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    57
    // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    58
    // Additionally use at least one thread.
27153
078af0a29311 8060116: After JDK-8047976 gc/g1/TestSummarizeRSetStatsThreads fails
mlarsson
parents: 20310
diff changeset
    59
    int expectedNumRefinementThreads = refinementThreads;
078af0a29311 8060116: After JDK-8047976 gc/g1/TestSummarizeRSetStatsThreads fails
mlarsson
parents: 20310
diff changeset
    60
35061
be6025ebffea 8145092: Use Unified Logging for the GC logging
brutisso
parents: 30604
diff changeset
    61
    String pattern = "Concurrent RS threads times \\(s\\)$";
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    62
    Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    63
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    64
    if (!m.find()) {
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    65
      throw new Exception("Could not find correct output for concurrent RS threads times in stdout," +
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    66
        " should match the pattern \"" + pattern + "\", but stdout is \n" + output.getStdout());
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    67
    }
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    68
    output.shouldHaveExitValue(0);
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    69
  }
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    70
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    71
  public static void main(String[] args) throws Exception {
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    72
    // different valid combinations of number of refinement and gc worker threads
27153
078af0a29311 8060116: After JDK-8047976 gc/g1/TestSummarizeRSetStatsThreads fails
mlarsson
parents: 20310
diff changeset
    73
    runTest(1, 1);
078af0a29311 8060116: After JDK-8047976 gc/g1/TestSummarizeRSetStatsThreads fails
mlarsson
parents: 20310
diff changeset
    74
    runTest(1, 5);
078af0a29311 8060116: After JDK-8047976 gc/g1/TestSummarizeRSetStatsThreads fails
mlarsson
parents: 20310
diff changeset
    75
    runTest(5, 1);
20310
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    76
    runTest(10, 10);
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    77
    runTest(1, 2);
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    78
    runTest(4, 3);
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    79
  }
903b398490d9 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
    80
}