< prev index next >

test/hotspot/jtreg/gc/g1/TestRemsetLoggingThreads.java

8217389: JTREG: Clean up, remove unused variable warnings

36  */                                                                                                                        
37 
38 import java.util.regex.Matcher;                                                                                            
39 import java.util.regex.Pattern;                                                                                            
40 
41 import jdk.test.lib.process.OutputAnalyzer;                                                                                
42 import jdk.test.lib.process.ProcessTools;                                                                                  
43 
44 public class TestRemsetLoggingThreads {                                                                                    
45 
46   private static void runTest(int refinementThreads, int workerThreads) throws Exception {                                 
47     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",                                              
48                                                               "-XX:+UnlockDiagnosticVMOptions",                            
49                                                               "-Xlog:gc+remset+exit=trace",                                
50                                                               "-XX:G1ConcRefinementThreads=" + refinementThreads,          
51                                                               "-XX:ParallelGCThreads=" + workerThreads,                    
52                                                               "-version");                                                 
53 
54     OutputAnalyzer output = new OutputAnalyzer(pb.start());                                                                
55 
56     // a zero in refinement thread numbers indicates that the value in ParallelGCThreads should be used.                   
57     // Additionally use at least one thread.                                                                               
58     int expectedNumRefinementThreads = refinementThreads;                                                                  
59                                                                                                                            
60     String pattern = "Concurrent RS threads times \\(s\\)$";                                                               
61     Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());                                   
62 
63     if (!m.find()) {                                                                                                       
64       throw new Exception("Could not find correct output for concurrent RS threads times in stdout," +                     
65         " should match the pattern \"" + pattern + "\", but stdout is \n" + output.getStdout());                           
66     }                                                                                                                      
67     output.shouldHaveExitValue(0);                                                                                         
68   }                                                                                                                        
69 
70   public static void main(String[] args) throws Exception {                                                                
71     // different valid combinations of number of refinement and gc worker threads                                          
72     runTest(1, 1);                                                                                                         
73     runTest(1, 5);                                                                                                         
74     runTest(5, 1);                                                                                                         
75     runTest(10, 10);                                                                                                       
76     runTest(1, 2);                                                                                                         
77     runTest(4, 3);                                                                                                         
78   }                                                                                                                        

36  */
37 
38 import java.util.regex.Matcher;
39 import java.util.regex.Pattern;
40 
41 import jdk.test.lib.process.OutputAnalyzer;
42 import jdk.test.lib.process.ProcessTools;
43 
44 public class TestRemsetLoggingThreads {
45 
46   private static void runTest(int refinementThreads, int workerThreads) throws Exception {
47     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
48                                                               "-XX:+UnlockDiagnosticVMOptions",
49                                                               "-Xlog:gc+remset+exit=trace",
50                                                               "-XX:G1ConcRefinementThreads=" + refinementThreads,
51                                                               "-XX:ParallelGCThreads=" + workerThreads,
52                                                               "-version");
53 
54     OutputAnalyzer output = new OutputAnalyzer(pb.start());
55 




56     String pattern = "Concurrent RS threads times \\(s\\)$";
57     Matcher m = Pattern.compile(pattern, Pattern.MULTILINE).matcher(output.getStdout());
58 
59     if (!m.find()) {
60       throw new Exception("Could not find correct output for concurrent RS threads times in stdout," +
61         " should match the pattern \"" + pattern + "\", but stdout is \n" + output.getStdout());
62     }
63     output.shouldHaveExitValue(0);
64   }
65 
66   public static void main(String[] args) throws Exception {
67     // different valid combinations of number of refinement and gc worker threads
68     runTest(1, 1);
69     runTest(1, 5);
70     runTest(5, 1);
71     runTest(10, 10);
72     runTest(1, 2);
73     runTest(4, 3);
74   }
< prev index next >