447 }
448
449 void G1GCPhaseTimes::print() {
450 note_gc_end();
451
452 if (_cur_verify_before_time_ms > 0.0) {
453 debug_time("Verify Before", _cur_verify_before_time_ms);
454 }
455
456 double accounted_ms = 0.0;
457 accounted_ms += print_pre_evacuate_collection_set();
458 accounted_ms += print_evacuate_collection_set();
459 accounted_ms += print_post_evacuate_collection_set();
460 print_other(accounted_ms);
461
462 if (_cur_verify_after_time_ms > 0.0) {
463 debug_time("Verify After", _cur_verify_after_time_ms);
464 }
465 }
466
467 G1EvacPhaseWithTrimTimeTracker::G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& t
468 _pss(pss),
469 _start(Ticks::now()),
470 _total_time(total_time),
471 _trim_time(trim_time),
472 _stopped(false) {
473
474 assert(_pss->trim_ticks().value() == 0, "Possibly remaining trim ticks left over from previous use");
475 }
476
477 G1EvacPhaseWithTrimTimeTracker::~G1EvacPhaseWithTrimTimeTracker() {
478 if (!_stopped) {
479 stop();
480 }
481 }
482
483 void G1EvacPhaseWithTrimTimeTracker::stop() {
484 assert(!_stopped, "Should only be called once");
485 _total_time += (Ticks::now() - _start) - _pss->trim_ticks();
486 _trim_time += _pss->trim_ticks();
487 _pss->reset_trim_ticks();
488 _stopped = true;
489 }
490
491 G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint wor
492 _start_time(), _phase(phase), _phase_times(phase_times), _worker_id(worker_id) {
493 if (_phase_times != NULL) {
494 _start_time = Ticks::now();
495 }
496 }
497
498 G1GCParPhaseTimesTracker::~G1GCParPhaseTimesTracker() {
499 if (_phase_times != NULL) {
500 _phase_times->record_time_secs(_phase, _worker_id, (Ticks::now() - _start_time).seconds());
501 }
502 }
503
504 G1EvacPhaseTimesTracker::G1EvacPhaseTimesTracker(G1GCPhaseTimes* phase_times,
505 G1ParScanThreadState* pss,
506 G1GCPhaseTimes::GCParPhases phase,
507 uint worker_id) :
508 G1GCParPhaseTimesTracker(phase_times, phase, worker_id),
509 _total_time(),
510 _trim_time(),
511 _trim_tracker(pss, _total_time, _trim_time) {
512 }
513
514 G1EvacPhaseTimesTracker::~G1EvacPhaseTimesTracker() {
515 if (_phase_times != NULL) {
516 // Explicitly stop the trim tracker since it's not yet destructed.
517 _trim_tracker.stop();
518 // Exclude trim time by increasing the start time.
519 _start_time += _trim_time;
|
447 }
448
449 void G1GCPhaseTimes::print() {
450 note_gc_end();
451
452 if (_cur_verify_before_time_ms > 0.0) {
453 debug_time("Verify Before", _cur_verify_before_time_ms);
454 }
455
456 double accounted_ms = 0.0;
457 accounted_ms += print_pre_evacuate_collection_set();
458 accounted_ms += print_evacuate_collection_set();
459 accounted_ms += print_post_evacuate_collection_set();
460 print_other(accounted_ms);
461
462 if (_cur_verify_after_time_ms > 0.0) {
463 debug_time("Verify After", _cur_verify_after_time_ms);
464 }
465 }
466
467 const char* G1GCPhaseTimes::phase_name(GCParPhases phase) {
468 static const char* names[] = {
469 "GCWorkerStart",
470 "ExtRootScan",
471 "ThreadRoots",
472 "StringTableRoots",
473 "UniverseRoots",
474 "JNIRoots",
475 "ObjectSynchronizerRoots",
476 "ManagementRoots",
477 "SystemDictionaryRoots",
478 "CLDGRoots",
479 "JVMTIRoots",
480 "CMRefRoots",
481 "WaitForStrongCLD",
482 "WeakCLDRoots",
483 "SATBFiltering",
484 "UpdateRS",
485 "ScanHCC",
486 "ScanRS",
487 "CodeRoots",
488 #if INCLUDE_AOT
489 "AOTCodeRoots",
490 #endif
491 "ObjCopy",
492 "Termination",
493 "Other",
494 "GCWorkerTotal",
495 "GCWorkerEnd",
496 "StringDedupQueueFixup",
497 "StringDedupTableFixup",
498 "RedirtyCards",
499 "YoungFreeCSet",
500 "NonYoungFreeCSet"
501 //GCParPhasesSentinel only used to tell end of enum
502 };
503
504 STATIC_ASSERT(ARRAY_SIZE(names) == G1GCPhaseTimes::GCParPhasesSentinel); // GCParPhases enum and corresponding string arr
505
506 return names[phase];
507 }
508
509 G1EvacPhaseWithTrimTimeTracker::G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& t
510 _pss(pss),
511 _start(Ticks::now()),
512 _total_time(total_time),
513 _trim_time(trim_time),
514 _stopped(false) {
515
516 assert(_pss->trim_ticks().value() == 0, "Possibly remaining trim ticks left over from previous use");
517 }
518
519 G1EvacPhaseWithTrimTimeTracker::~G1EvacPhaseWithTrimTimeTracker() {
520 if (!_stopped) {
521 stop();
522 }
523 }
524
525 void G1EvacPhaseWithTrimTimeTracker::stop() {
526 assert(!_stopped, "Should only be called once");
527 _total_time += (Ticks::now() - _start) - _pss->trim_ticks();
528 _trim_time += _pss->trim_ticks();
529 _pss->reset_trim_ticks();
530 _stopped = true;
531 }
532
533 G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint wor
534 _start_time(), _phase(phase), _phase_times(phase_times), _worker_id(worker_id), _event() {
535 if (_phase_times != NULL) {
536 _start_time = Ticks::now();
537 }
538 }
539
540 G1GCParPhaseTimesTracker::~G1GCParPhaseTimesTracker() {
541 if (_phase_times != NULL) {
542 _phase_times->record_time_secs(_phase, _worker_id, (Ticks::now() - _start_time).seconds());
543 _event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_phase));
544 }
545 }
546
547 G1EvacPhaseTimesTracker::G1EvacPhaseTimesTracker(G1GCPhaseTimes* phase_times,
548 G1ParScanThreadState* pss,
549 G1GCPhaseTimes::GCParPhases phase,
550 uint worker_id) :
551 G1GCParPhaseTimesTracker(phase_times, phase, worker_id),
552 _total_time(),
553 _trim_time(),
554 _trim_tracker(pss, _total_time, _trim_time) {
555 }
556
557 G1EvacPhaseTimesTracker::~G1EvacPhaseTimesTracker() {
558 if (_phase_times != NULL) {
559 // Explicitly stop the trim tracker since it's not yet destructed.
560 _trim_tracker.stop();
561 // Exclude trim time by increasing the start time.
562 _start_time += _trim_time;
|