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