25 |
25 |
26 #include "precompiled.hpp" |
26 #include "precompiled.hpp" |
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
27 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
28 #include "gc_implementation/g1/g1GCPhaseTimes.hpp" |
28 #include "gc_implementation/g1/g1GCPhaseTimes.hpp" |
29 #include "gc_implementation/g1/g1Log.hpp" |
29 #include "gc_implementation/g1/g1Log.hpp" |
|
30 #include "gc_implementation/g1/g1StringDedup.hpp" |
30 |
31 |
31 // Helper class for avoiding interleaved logging |
32 // Helper class for avoiding interleaved logging |
32 class LineBuffer: public StackObj { |
33 class LineBuffer: public StackObj { |
33 |
34 |
34 private: |
35 private: |
166 _last_obj_copy_times_ms(_max_gc_threads, "%.1lf"), |
167 _last_obj_copy_times_ms(_max_gc_threads, "%.1lf"), |
167 _last_termination_times_ms(_max_gc_threads, "%.1lf"), |
168 _last_termination_times_ms(_max_gc_threads, "%.1lf"), |
168 _last_termination_attempts(_max_gc_threads, SIZE_FORMAT), |
169 _last_termination_attempts(_max_gc_threads, SIZE_FORMAT), |
169 _last_gc_worker_end_times_ms(_max_gc_threads, "%.1lf", false), |
170 _last_gc_worker_end_times_ms(_max_gc_threads, "%.1lf", false), |
170 _last_gc_worker_times_ms(_max_gc_threads, "%.1lf"), |
171 _last_gc_worker_times_ms(_max_gc_threads, "%.1lf"), |
171 _last_gc_worker_other_times_ms(_max_gc_threads, "%.1lf") |
172 _last_gc_worker_other_times_ms(_max_gc_threads, "%.1lf"), |
|
173 _cur_string_dedup_queue_fixup_worker_times_ms(_max_gc_threads, "%.1lf"), |
|
174 _cur_string_dedup_table_fixup_worker_times_ms(_max_gc_threads, "%.1lf") |
172 { |
175 { |
173 assert(max_gc_threads > 0, "Must have some GC threads"); |
176 assert(max_gc_threads > 0, "Must have some GC threads"); |
174 } |
177 } |
175 |
178 |
176 void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) { |
179 void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) { |
227 |
230 |
228 _last_gc_worker_times_ms.verify(); |
231 _last_gc_worker_times_ms.verify(); |
229 _last_gc_worker_other_times_ms.verify(); |
232 _last_gc_worker_other_times_ms.verify(); |
230 } |
233 } |
231 |
234 |
|
235 void G1GCPhaseTimes::note_string_dedup_fixup_start() { |
|
236 _cur_string_dedup_queue_fixup_worker_times_ms.reset(); |
|
237 _cur_string_dedup_table_fixup_worker_times_ms.reset(); |
|
238 } |
|
239 |
|
240 void G1GCPhaseTimes::note_string_dedup_fixup_end() { |
|
241 _cur_string_dedup_queue_fixup_worker_times_ms.verify(); |
|
242 _cur_string_dedup_table_fixup_worker_times_ms.verify(); |
|
243 } |
|
244 |
232 void G1GCPhaseTimes::print_stats(int level, const char* str, double value) { |
245 void G1GCPhaseTimes::print_stats(int level, const char* str, double value) { |
233 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value); |
246 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value); |
234 } |
247 } |
235 |
248 |
236 void G1GCPhaseTimes::print_stats(int level, const char* str, double value, int workers) { |
249 void G1GCPhaseTimes::print_stats(int level, const char* str, double value, int workers) { |
250 // Strong code root migration time |
263 // Strong code root migration time |
251 misc_time_ms += _cur_strong_code_root_migration_time_ms; |
264 misc_time_ms += _cur_strong_code_root_migration_time_ms; |
252 |
265 |
253 // Strong code root purge time |
266 // Strong code root purge time |
254 misc_time_ms += _cur_strong_code_root_purge_time_ms; |
267 misc_time_ms += _cur_strong_code_root_purge_time_ms; |
|
268 |
|
269 if (G1StringDedup::is_enabled()) { |
|
270 // String dedup fixup time |
|
271 misc_time_ms += _cur_string_dedup_fixup_time_ms; |
|
272 } |
255 |
273 |
256 // Subtract the time taken to clean the card table from the |
274 // Subtract the time taken to clean the card table from the |
257 // current value of "other time" |
275 // current value of "other time" |
258 misc_time_ms += _cur_clear_ct_time_ms; |
276 misc_time_ms += _cur_clear_ct_time_ms; |
259 |
277 |
301 _last_obj_copy_times_ms.print(1, "Object Copy (ms)"); |
319 _last_obj_copy_times_ms.print(1, "Object Copy (ms)"); |
302 } |
320 } |
303 print_stats(1, "Code Root Fixup", _cur_collection_code_root_fixup_time_ms); |
321 print_stats(1, "Code Root Fixup", _cur_collection_code_root_fixup_time_ms); |
304 print_stats(1, "Code Root Migration", _cur_strong_code_root_migration_time_ms); |
322 print_stats(1, "Code Root Migration", _cur_strong_code_root_migration_time_ms); |
305 print_stats(1, "Code Root Purge", _cur_strong_code_root_purge_time_ms); |
323 print_stats(1, "Code Root Purge", _cur_strong_code_root_purge_time_ms); |
|
324 if (G1StringDedup::is_enabled()) { |
|
325 print_stats(1, "String Dedup Fixup", _cur_string_dedup_fixup_time_ms, _active_gc_threads); |
|
326 _cur_string_dedup_queue_fixup_worker_times_ms.print(2, "Queue Fixup (ms)"); |
|
327 _cur_string_dedup_table_fixup_worker_times_ms.print(2, "Table Fixup (ms)"); |
|
328 } |
306 print_stats(1, "Clear CT", _cur_clear_ct_time_ms); |
329 print_stats(1, "Clear CT", _cur_clear_ct_time_ms); |
307 double misc_time_ms = pause_time_sec * MILLIUNITS - accounted_time_ms(); |
330 double misc_time_ms = pause_time_sec * MILLIUNITS - accounted_time_ms(); |
308 print_stats(1, "Other", misc_time_ms); |
331 print_stats(1, "Other", misc_time_ms); |
309 if (_cur_verify_before_time_ms > 0.0) { |
332 if (_cur_verify_before_time_ms > 0.0) { |
310 print_stats(2, "Verify Before", _cur_verify_before_time_ms); |
333 print_stats(2, "Verify Before", _cur_verify_before_time_ms); |