< prev index next >

test/gc/g1/TestRemsetLoggingThreads.java

Print this page




   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test TestRemsetLoggingThreads
  26  * @requires vm.gc.G1
  27  * @bug 8025441 8145534
  28  * @key gc
  29  * @library /testlibrary
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management/sun.management
  32  * @summary Ensure that various values of worker threads/concurrent
  33  * refinement threads do not crash the VM.
  34  */
  35 
  36 import java.util.regex.Matcher;
  37 import java.util.regex.Pattern;
  38 
  39 import jdk.test.lib.ProcessTools;
  40 import jdk.test.lib.OutputAnalyzer;
  41 
  42 public class TestRemsetLoggingThreads {
  43 
  44   private static void runTest(int refinementThreads, int workerThreads) throws Exception {
  45     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  46                                                               "-XX:+UnlockDiagnosticVMOptions",
  47                                                               "-Xlog:gc+remset+exit=trace",
  48                                                               "-XX:G1ConcRefinementThreads=" + refinementThreads,
  49                                                               "-XX:ParallelGCThreads=" + workerThreads,
  50                                                               "-version");
  51 
  52     OutputAnalyzer output = new OutputAnalyzer(pb.start());
  53 
  54     // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
  55     // Additionally use at least one thread.
  56     int expectedNumRefinementThreads = refinementThreads;
  57 
  58     String pattern = "Concurrent RS threads times \\(s\\)$";
  59     Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
  60 


   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 /*
  25  * @test TestRemsetLoggingThreads
  26  * @requires vm.gc.G1
  27  * @bug 8025441 8145534
  28  * @key gc
  29  * @library /test/lib
  30  * @modules java.base/jdk.internal.misc
  31  *          java.management/sun.management
  32  * @summary Ensure that various values of worker threads/concurrent
  33  * refinement threads do not crash the VM.
  34  */
  35 
  36 import java.util.regex.Matcher;
  37 import java.util.regex.Pattern;
  38 
  39 import jdk.test.lib.process.OutputAnalyzer;
  40 import jdk.test.lib.process.ProcessTools;
  41 
  42 public class TestRemsetLoggingThreads {
  43 
  44   private static void runTest(int refinementThreads, int workerThreads) throws Exception {
  45     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
  46                                                               "-XX:+UnlockDiagnosticVMOptions",
  47                                                               "-Xlog:gc+remset+exit=trace",
  48                                                               "-XX:G1ConcRefinementThreads=" + refinementThreads,
  49                                                               "-XX:ParallelGCThreads=" + workerThreads,
  50                                                               "-version");
  51 
  52     OutputAnalyzer output = new OutputAnalyzer(pb.start());
  53 
  54     // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.
  55     // Additionally use at least one thread.
  56     int expectedNumRefinementThreads = refinementThreads;
  57 
  58     String pattern = "Concurrent RS threads times \\(s\\)$";
  59     Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
  60 
< prev index next >