< prev index next >
test/gc/g1/TestDynamicGCThreadsStats.java
Print this page
*** 65,99 ****
output.shouldHaveExitValue(0);
// Looking for:
// [0.234s][debug ][gc,phases ] GC(0) Evacuate Collection Set: 3.7 ms
! String parallel_phase_leader = "Evacuate Collection Set: \\d+\\.\\d+ms";
! String std_out = output.getStdout();
! Matcher m = Pattern.compile(parallel_phase_leader, Pattern.MULTILINE).matcher(std_out);
!
! if (!m.find()) {
! throw new Exception("Could not find correct output for Evacuate Collection Set: in stdout," +
! " should match the pattern \"" + parallel_phase_leader + "\", but stdout is \n" + output.getStdout());
! } else {
// Find data with per thread times.
// Any of the metrics with per thread times can be used.
// Chose:
// [0.234s][debug ][gc,phases ] GC(0) Ext Root Scanning: Min: 0.6, Avg: 1.1, Max: 1.6, Diff: 1.0, Sum: 2.2
String stats = "Ext Root Scanning \\(ms\\):";
Pattern stats_pattern = Pattern.compile(stats);
! m.usePattern(stats_pattern);
! if (!m.find()) {
! throw new Exception("Could not find correct output for chosen statistics in stdout," +
! " should match the pattern \"" + stats + "\", but stdout is \n" + output.getStdout());
! } else {
// Find the printed average from the log.
! Pattern avg_pattern = Pattern.compile("(Avg: +)(\\d+\\.\\d+)(,)");
! m.usePattern(avg_pattern);
if (!m.find()) {
throw new Exception("Could not find Avg: dd.d in stdout\n," + output.getStdout());
! } else {
String value_string = m.group(2);
// Count the decimal places in the printed average. The
// number of decimal places will be used to calculate the
// rounding error when the per thread values are summed in
// this test.
--- 65,89 ----
output.shouldHaveExitValue(0);
// Looking for:
// [0.234s][debug ][gc,phases ] GC(0) Evacuate Collection Set: 3.7 ms
! output.shouldMatch("Evacuate Collection Set: \\d+\\.\\d+ms");
// Find data with per thread times.
// Any of the metrics with per thread times can be used.
// Chose:
// [0.234s][debug ][gc,phases ] GC(0) Ext Root Scanning: Min: 0.6, Avg: 1.1, Max: 1.6, Diff: 1.0, Sum: 2.2
String stats = "Ext Root Scanning \\(ms\\):";
Pattern stats_pattern = Pattern.compile(stats);
! output.shouldMatch("Ext Root Scanning \\(ms\\):");
// Find the printed average from the log.
! String std_out = output.getStdout();
! String avg_line = "(Avg: +)(\\d+\\.\\d+)(,)";
! Matcher m = Pattern.compile(avg_line, Pattern.MULTILINE).matcher(std_out);
if (!m.find()) {
throw new Exception("Could not find Avg: dd.d in stdout\n," + output.getStdout());
! }
String value_string = m.group(2);
// Count the decimal places in the printed average. The
// number of decimal places will be used to calculate the
// rounding error when the per thread values are summed in
// this test.
*** 134,153 ****
Double rounding_error = workers * 0.5 * Math.pow(10.0, -decimal_points);
if (Math.abs(calculated_avg - avg_value) > rounding_error) {
throw new Exception("Average from log " + avg_value + " and average calculated by test " +
calculated_avg + " can differ by rounding error " + rounding_error);
} else {
-
System.err.println("PASSED: Average from log " + avg_value + " and average calculated by test " +
calculated_avg + " can differ by rounding error " + rounding_error);
}
}
}
- System.out.println(output.getStdout());
- }
- }
- }
}
public static void main(String[] args) throws Exception {
runTest();
}
--- 124,138 ----
< prev index next >