1.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Mar 25 17:39:20 2011 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Mar 23 14:12:51 2011 +0100 1.3 @@ -307,6 +307,7 @@ 1.4 _par_last_termination_times_ms = new double[_parallel_gc_threads]; 1.5 _par_last_termination_attempts = new double[_parallel_gc_threads]; 1.6 _par_last_gc_worker_end_times_ms = new double[_parallel_gc_threads]; 1.7 + _par_last_gc_worker_times_ms = new double[_parallel_gc_threads]; 1.8 1.9 // start conservatively 1.10 _expensive_region_limit_ms = 0.5 * (double) MaxGCPauseMillis; 1.11 @@ -911,6 +912,7 @@ 1.12 _par_last_termination_times_ms[i] = -1234.0; 1.13 _par_last_termination_attempts[i] = -1234.0; 1.14 _par_last_gc_worker_end_times_ms[i] = -1234.0; 1.15 + _par_last_gc_worker_times_ms[i] = -1234.0; 1.16 } 1.17 #endif 1.18 1.19 @@ -1063,8 +1065,7 @@ 1.20 1.21 void G1CollectorPolicy::print_par_stats(int level, 1.22 const char* str, 1.23 - double* data, 1.24 - bool summary) { 1.25 + double* data) { 1.26 double min = data[0], max = data[0]; 1.27 double total = 0.0; 1.28 LineBuffer buf(level); 1.29 @@ -1078,20 +1079,15 @@ 1.30 total += val; 1.31 buf.append(" %3.1lf", val); 1.32 } 1.33 - if (summary) { 1.34 - buf.append_and_print_cr(""); 1.35 - double avg = total / (double) ParallelGCThreads; 1.36 - buf.append(" "); 1.37 - buf.append("Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf", 1.38 - avg, min, max); 1.39 - } 1.40 - buf.append_and_print_cr("]"); 1.41 + buf.append_and_print_cr(""); 1.42 + double avg = total / (double) ParallelGCThreads; 1.43 + buf.append_and_print_cr(" Avg: %5.1lf, Min: %5.1lf, Max: %5.1lf, Diff: %5.1lf]", 1.44 + avg, min, max, max - min); 1.45 } 1.46 1.47 void G1CollectorPolicy::print_par_sizes(int level, 1.48 const char* str, 1.49 - double* data, 1.50 - bool summary) { 1.51 + double* data) { 1.52 double min = data[0], max = data[0]; 1.53 double total = 0.0; 1.54 LineBuffer buf(level); 1.55 @@ -1105,14 +1101,10 @@ 1.56 total += val; 1.57 buf.append(" %d", (int) val); 1.58 } 1.59 - if (summary) { 1.60 - buf.append_and_print_cr(""); 1.61 - double avg = total / (double) ParallelGCThreads; 1.62 - buf.append(" "); 1.63 - buf.append("Sum: %d, Avg: %d, Min: %d, Max: %d", 1.64 - (int)total, (int)avg, (int)min, (int)max); 1.65 - } 1.66 - buf.append_and_print_cr("]"); 1.67 + buf.append_and_print_cr(""); 1.68 + double avg = total / (double) ParallelGCThreads; 1.69 + buf.append_and_print_cr(" Sum: %d, Avg: %d, Min: %d, Max: %d, Diff: %d]", 1.70 + (int)total, (int)avg, (int)min, (int)max, (int)max - (int)min); 1.71 } 1.72 1.73 void G1CollectorPolicy::print_stats (int level, 1.74 @@ -1421,22 +1413,22 @@ 1.75 } 1.76 if (parallel) { 1.77 print_stats(1, "Parallel Time", _cur_collection_par_time_ms); 1.78 - print_par_stats(2, "GC Worker Start Time", 1.79 - _par_last_gc_worker_start_times_ms, false); 1.80 + print_par_stats(2, "GC Worker Start Time", _par_last_gc_worker_start_times_ms); 1.81 print_par_stats(2, "Update RS", _par_last_update_rs_times_ms); 1.82 - print_par_sizes(3, "Processed Buffers", 1.83 - _par_last_update_rs_processed_buffers, true); 1.84 - print_par_stats(2, "Ext Root Scanning", 1.85 - _par_last_ext_root_scan_times_ms); 1.86 - print_par_stats(2, "Mark Stack Scanning", 1.87 - _par_last_mark_stack_scan_times_ms); 1.88 + print_par_sizes(3, "Processed Buffers", _par_last_update_rs_processed_buffers); 1.89 + print_par_stats(2, "Ext Root Scanning", _par_last_ext_root_scan_times_ms); 1.90 + print_par_stats(2, "Mark Stack Scanning", _par_last_mark_stack_scan_times_ms); 1.91 print_par_stats(2, "Scan RS", _par_last_scan_rs_times_ms); 1.92 print_par_stats(2, "Object Copy", _par_last_obj_copy_times_ms); 1.93 print_par_stats(2, "Termination", _par_last_termination_times_ms); 1.94 - print_par_sizes(3, "Termination Attempts", 1.95 - _par_last_termination_attempts, true); 1.96 - print_par_stats(2, "GC Worker End Time", 1.97 - _par_last_gc_worker_end_times_ms, false); 1.98 + print_par_sizes(3, "Termination Attempts", _par_last_termination_attempts); 1.99 + print_par_stats(2, "GC Worker End Time", _par_last_gc_worker_end_times_ms); 1.100 + 1.101 + for (int i = 0; i < _parallel_gc_threads; i++) { 1.102 + _par_last_gc_worker_times_ms[i] = _par_last_gc_worker_end_times_ms[i] - _par_last_gc_worker_start_times_ms[i]; 1.103 + } 1.104 + print_par_stats(2, "GC Worker Times", _par_last_gc_worker_times_ms); 1.105 + 1.106 print_stats(2, "Other", parallel_other_time); 1.107 print_stats(1, "Clear CT", _cur_clear_ct_time_ms); 1.108 } else {