annotate test/gc/g1/TestSummarizeRSetStatsThreads.java @ 12355:cefad50507d8

Merge with hs25-b53
author Gilles Duboscq <duboscq@ssw.jku.at>
date Fri, 11 Oct 2013 10:38:03 +0200
parents 7ec10139bf37
children 05b726bce3e6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12344
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
1 /*
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
7ec10139bf37 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.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
4 *
7ec10139bf37 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
7ec10139bf37 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
7ec10139bf37 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.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
8 *
7ec10139bf37 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
7ec10139bf37 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
7ec10139bf37 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
7ec10139bf37 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
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
13 * accompanied this code).
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
14 *
7ec10139bf37 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
7ec10139bf37 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,
7ec10139bf37 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.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
18 *
7ec10139bf37 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
7ec10139bf37 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
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
21 * questions.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
22 */
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
23
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
24 /*
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
25 * @test TestSummarizeRSetStatsThreads
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
26 * @bug 8025441
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
27 * @summary Ensure that various values of worker threads/concurrent
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
28 * refinement threads do not crash the VM.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
29 * @key gc
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
30 * @library /testlibrary
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
31 */
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
32
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
33 import java.util.regex.Matcher;
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
34 import java.util.regex.Pattern;
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
35
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
36 import com.oracle.java.testlibrary.ProcessTools;
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
37 import com.oracle.java.testlibrary.OutputAnalyzer;
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
38
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
39 public class TestSummarizeRSetStatsThreads {
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
40
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
41 private static void runTest(int refinementThreads, int workerThreads) throws Exception {
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
42 ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
43 "-XX:+UnlockDiagnosticVMOptions",
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
44 "-XX:+G1SummarizeRSetStats",
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
45 "-XX:G1ConcRefinementThreads=" + refinementThreads,
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
46 "-XX:ParallelGCThreads=" + workerThreads,
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
47 "-version");
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
48
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
49 OutputAnalyzer output = new OutputAnalyzer(pb.start());
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
50
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
51 // check output to contain the string "Concurrent RS threads times (s)" followed by
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
52 // the correct number of values in the next line.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
53
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
54 // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
55 // Additionally use at least one thread.
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
56 int expectedNumRefinementThreads = refinementThreads == 0 ? workerThreads : refinementThreads;
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
57 expectedNumRefinementThreads = Math.max(1, expectedNumRefinementThreads);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
58 // create the pattern made up of n copies of a floating point number pattern
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
59 String numberPattern = String.format("%0" + expectedNumRefinementThreads + "d", 0)
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
60 .replace("0", "\\s+\\d+\\.\\d+");
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
61 String pattern = "Concurrent RS threads times \\(s\\)$" + numberPattern + "$";
7ec10139bf37 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());
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
63
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
64 if (!m.find()) {
7ec10139bf37 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," +
7ec10139bf37 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());
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
67 }
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
68 output.shouldHaveExitValue(0);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
69 }
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
70
7ec10139bf37 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 {
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
72 if (!TestSummarizeRSetStatsTools.testingG1GC()) {
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
73 return;
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
74 }
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
75 // different valid combinations of number of refinement and gc worker threads
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
76 runTest(0, 0);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
77 runTest(0, 5);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
78 runTest(5, 0);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
79 runTest(10, 10);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
80 runTest(1, 2);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
81 runTest(4, 3);
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
82 }
7ec10139bf37 8025441: G1: assert "assert(thread < _num_vtimes) failed: just checking" fails when G1ConcRefinementThreads > ParallelGCThreads
tschatzl
parents:
diff changeset
83 }