314 _gc_par_phases[SATBFiltering]->get(i) +
315 _gc_par_phases[UpdateRS]->get(i) +
316 _gc_par_phases[ScanRS]->get(i) +
317 _gc_par_phases[CodeRoots]->get(i) +
318 _gc_par_phases[ObjCopy]->get(i) +
319 _gc_par_phases[Termination]->get(i);
320
321 record_time_secs(Other, i, worker_time - worker_known_time);
322 }
323
324 for (int i = 0; i < GCParPhasesSentinel; i++) {
325 _gc_par_phases[i]->verify(_active_gc_threads);
326 }
327 }
328
329 void G1GCPhaseTimes::print_stats(int level, const char* str, double value) {
330 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value);
331 }
332
333 void G1GCPhaseTimes::print_stats(int level, const char* str, size_t value) {
334 LineBuffer(level).append_and_print_cr("[%s: "SIZE_FORMAT"]", str, value);
335 }
336
337 void G1GCPhaseTimes::print_stats(int level, const char* str, double value, uint workers) {
338 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %u]", str, value, workers);
339 }
340
341 double G1GCPhaseTimes::accounted_time_ms() {
342 // Subtract the root region scanning wait time. It's initialized to
343 // zero at the start of the pause.
344 double misc_time_ms = _root_region_scan_wait_time_ms;
345
346 misc_time_ms += _cur_collection_par_time_ms;
347
348 // Now subtract the time taken to fix up roots in generated code
349 misc_time_ms += _cur_collection_code_root_fixup_time_ms;
350
351 // Strong code root purge time
352 misc_time_ms += _cur_strong_code_root_purge_time_ms;
353
354 if (G1StringDedup::is_enabled()) {
434 if (phase->_log_level > G1Log::level() || !phase->_enabled) {
435 return;
436 }
437
438 if (phase->_length == 1) {
439 print_single_length(phase_id, phase);
440 } else {
441 print_multi_length(phase_id, phase);
442 }
443 }
444
445 private:
446
447 void print_single_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
448 // No need for min, max, average and sum for only one worker
449 LineBuffer buf(phase->_indent_level);
450 buf.append_and_print_cr("[%s: %.1lf]", phase->_title, _phase_times->get_time_ms(phase_id, 0));
451
452 if (phase->_thread_work_items != NULL) {
453 LineBuffer buf2(phase->_thread_work_items->_indent_level);
454 buf2.append_and_print_cr("[%s: "SIZE_FORMAT"]", phase->_thread_work_items->_title, _phase_times->sum_thread_work_items(phase_id));
455 }
456 }
457
458 void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
459 uint active_length = _phase_times->_active_gc_threads;
460 for (uint i = 0; i < active_length; ++i) {
461 buf.append(" %.1lf", _phase_times->get_time_ms(phase_id, i));
462 }
463 buf.print_cr();
464 }
465
466 void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
467 uint active_length = _phase_times->_active_gc_threads;
468 for (uint i = 0; i < active_length; ++i) {
469 buf.append(" " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i));
470 }
471 buf.print_cr();
472 }
473
474 void print_thread_work_items(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
|
314 _gc_par_phases[SATBFiltering]->get(i) +
315 _gc_par_phases[UpdateRS]->get(i) +
316 _gc_par_phases[ScanRS]->get(i) +
317 _gc_par_phases[CodeRoots]->get(i) +
318 _gc_par_phases[ObjCopy]->get(i) +
319 _gc_par_phases[Termination]->get(i);
320
321 record_time_secs(Other, i, worker_time - worker_known_time);
322 }
323
324 for (int i = 0; i < GCParPhasesSentinel; i++) {
325 _gc_par_phases[i]->verify(_active_gc_threads);
326 }
327 }
328
329 void G1GCPhaseTimes::print_stats(int level, const char* str, double value) {
330 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms]", str, value);
331 }
332
333 void G1GCPhaseTimes::print_stats(int level, const char* str, size_t value) {
334 LineBuffer(level).append_and_print_cr("[%s: " SIZE_FORMAT "]", str, value);
335 }
336
337 void G1GCPhaseTimes::print_stats(int level, const char* str, double value, uint workers) {
338 LineBuffer(level).append_and_print_cr("[%s: %.1lf ms, GC Workers: %u]", str, value, workers);
339 }
340
341 double G1GCPhaseTimes::accounted_time_ms() {
342 // Subtract the root region scanning wait time. It's initialized to
343 // zero at the start of the pause.
344 double misc_time_ms = _root_region_scan_wait_time_ms;
345
346 misc_time_ms += _cur_collection_par_time_ms;
347
348 // Now subtract the time taken to fix up roots in generated code
349 misc_time_ms += _cur_collection_code_root_fixup_time_ms;
350
351 // Strong code root purge time
352 misc_time_ms += _cur_strong_code_root_purge_time_ms;
353
354 if (G1StringDedup::is_enabled()) {
434 if (phase->_log_level > G1Log::level() || !phase->_enabled) {
435 return;
436 }
437
438 if (phase->_length == 1) {
439 print_single_length(phase_id, phase);
440 } else {
441 print_multi_length(phase_id, phase);
442 }
443 }
444
445 private:
446
447 void print_single_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
448 // No need for min, max, average and sum for only one worker
449 LineBuffer buf(phase->_indent_level);
450 buf.append_and_print_cr("[%s: %.1lf]", phase->_title, _phase_times->get_time_ms(phase_id, 0));
451
452 if (phase->_thread_work_items != NULL) {
453 LineBuffer buf2(phase->_thread_work_items->_indent_level);
454 buf2.append_and_print_cr("[%s: " SIZE_FORMAT "]", phase->_thread_work_items->_title, _phase_times->sum_thread_work_items(phase_id));
455 }
456 }
457
458 void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
459 uint active_length = _phase_times->_active_gc_threads;
460 for (uint i = 0; i < active_length; ++i) {
461 buf.append(" %.1lf", _phase_times->get_time_ms(phase_id, i));
462 }
463 buf.print_cr();
464 }
465
466 void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
467 uint active_length = _phase_times->_active_gc_threads;
468 for (uint i = 0; i < active_length; ++i) {
469 buf.append(" " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i));
470 }
471 buf.print_cr();
472 }
473
474 void print_thread_work_items(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
|