43 _max_gc_threads(max_gc_threads),
44 _gc_start_counter(0),
45 _gc_pause_time_ms(0.0),
46 _ref_phase_times(gc_timer, max_gc_threads),
47 _weak_phase_times(max_gc_threads)
48 {
49 assert(max_gc_threads > 0, "Must have some GC threads");
50
51 _gc_par_phases[GCWorkerStart] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Start (ms):");
52 _gc_par_phases[ExtRootScan] = new WorkerDataArray<double>(max_gc_threads, "Ext Root Scanning (ms):");
53
54 // Root scanning phases
55 _gc_par_phases[ThreadRoots] = new WorkerDataArray<double>(max_gc_threads, "Thread Roots (ms):");
56 _gc_par_phases[UniverseRoots] = new WorkerDataArray<double>(max_gc_threads, "Universe Roots (ms):");
57 _gc_par_phases[JNIRoots] = new WorkerDataArray<double>(max_gc_threads, "JNI Handles Roots (ms):");
58 _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>(max_gc_threads, "ObjectSynchronizer Roots (ms):");
59 _gc_par_phases[ManagementRoots] = new WorkerDataArray<double>(max_gc_threads, "Management Roots (ms):");
60 _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>(max_gc_threads, "SystemDictionary Roots (ms):");
61 _gc_par_phases[CLDGRoots] = new WorkerDataArray<double>(max_gc_threads, "CLDG Roots (ms):");
62 _gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>(max_gc_threads, "JVMTI Roots (ms):");
63 _gc_par_phases[CMRefRoots] = new WorkerDataArray<double>(max_gc_threads, "CM RefProcessor Roots (ms):");
64 _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong CLD (ms):");
65 _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms):");
66 _gc_par_phases[SATBFiltering] = new WorkerDataArray<double>(max_gc_threads, "SATB Filtering (ms):");
67
68 _gc_par_phases[UpdateRS] = new WorkerDataArray<double>(max_gc_threads, "Update RS (ms):");
69 if (G1HotCardCache::default_use_cache()) {
70 _gc_par_phases[ScanHCC] = new WorkerDataArray<double>(max_gc_threads, "Scan HCC (ms):");
71 } else {
72 _gc_par_phases[ScanHCC] = NULL;
73 }
74 _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS (ms):");
75 _gc_par_phases[OptScanRS] = new WorkerDataArray<double>(max_gc_threads, "Optional Scan RS (ms):");
76 _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning (ms):");
77 #if INCLUDE_AOT
78 _gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>(max_gc_threads, "AOT Root Scanning (ms):");
79 #endif
80 _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy (ms):");
81 _gc_par_phases[OptObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Optional Object Copy (ms):");
82 _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination (ms):");
83 _gc_par_phases[GCWorkerTotal] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Total (ms):");
84 _gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>(max_gc_threads, "GC Worker End (ms):");
85 _gc_par_phases[Other] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Other (ms):");
86
87 _scan_rs_scanned_cards = new WorkerDataArray<size_t>(max_gc_threads, "Scanned Cards:");
88 _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_scanned_cards, ScanRSScannedCards);
89 _scan_rs_claimed_cards = new WorkerDataArray<size_t>(max_gc_threads, "Claimed Cards:");
90 _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_claimed_cards, ScanRSClaimedCards);
91 _scan_rs_skipped_cards = new WorkerDataArray<size_t>(max_gc_threads, "Skipped Cards:");
92 _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_skipped_cards, ScanRSSkippedCards);
93
94 _opt_cset_scanned_cards = new WorkerDataArray<size_t>(max_gc_threads, "Scanned Cards:");
95 _gc_par_phases[OptScanRS]->link_thread_work_items(_opt_cset_scanned_cards, OptCSetScannedCards);
96 _opt_cset_claimed_cards = new WorkerDataArray<size_t>(max_gc_threads, "Claimed Cards:");
97 _gc_par_phases[OptScanRS]->link_thread_work_items(_opt_cset_claimed_cards, OptCSetClaimedCards);
98 _opt_cset_skipped_cards = new WorkerDataArray<size_t>(max_gc_threads, "Skipped Cards:");
99 _gc_par_phases[OptScanRS]->link_thread_work_items(_opt_cset_skipped_cards, OptCSetSkippedCards);
372 }
373 return sum_ms;
374 }
375
376 double G1GCPhaseTimes::print_evacuate_collection_set() const {
377 const double sum_ms = _cur_collection_par_time_ms;
378
379 info_time("Evacuate Collection Set", sum_ms);
380
381 trace_phase(_gc_par_phases[GCWorkerStart], false);
382 debug_phase(_gc_par_phases[ExtRootScan]);
383 for (int i = ThreadRoots; i <= SATBFiltering; i++) {
384 trace_phase(_gc_par_phases[i]);
385 }
386 debug_phase(_gc_par_phases[UpdateRS]);
387 if (G1HotCardCache::default_use_cache()) {
388 trace_phase(_gc_par_phases[ScanHCC]);
389 }
390 debug_phase(_gc_par_phases[ScanRS]);
391 debug_phase(_gc_par_phases[CodeRoots]);
392 #if INCLUDE_AOT
393 debug_phase(_gc_par_phases[AOTCodeRoots]);
394 #endif
395 debug_phase(_gc_par_phases[ObjCopy]);
396 debug_phase(_gc_par_phases[Termination]);
397 debug_phase(_gc_par_phases[Other]);
398 debug_phase(_gc_par_phases[GCWorkerTotal]);
399 trace_phase(_gc_par_phases[GCWorkerEnd], false);
400
401 return sum_ms;
402 }
403
404 double G1GCPhaseTimes::print_post_evacuate_collection_set() const {
405 const double evac_fail_handling = _cur_evac_fail_recalc_used +
406 _cur_evac_fail_remove_self_forwards;
407 const double sum_ms = evac_fail_handling +
408 _cur_collection_code_root_fixup_time_ms +
409 _recorded_preserve_cm_referents_time_ms +
410 _cur_ref_proc_time_ms +
411 (_weak_phase_times.total_time_sec() * MILLIUNITS) +
412 _cur_clear_ct_time_ms +
413 _recorded_merge_pss_time_ms +
414 _cur_strong_code_root_purge_time_ms +
486 accounted_ms += print_post_evacuate_collection_set();
487 print_other(accounted_ms);
488
489 if (_cur_verify_after_time_ms > 0.0) {
490 debug_time("Verify After", _cur_verify_after_time_ms);
491 }
492 }
493
494 const char* G1GCPhaseTimes::phase_name(GCParPhases phase) {
495 static const char* names[] = {
496 "GCWorkerStart",
497 "ExtRootScan",
498 "ThreadRoots",
499 "UniverseRoots",
500 "JNIRoots",
501 "ObjectSynchronizerRoots",
502 "ManagementRoots",
503 "SystemDictionaryRoots",
504 "CLDGRoots",
505 "JVMTIRoots",
506 "CMRefRoots",
507 "WaitForStrongCLD",
508 "WeakCLDRoots",
509 "SATBFiltering",
510 "UpdateRS",
511 "ScanHCC",
512 "ScanRS",
513 "OptScanRS",
514 "CodeRoots",
515 #if INCLUDE_AOT
516 "AOTCodeRoots",
517 #endif
518 "ObjCopy",
519 "OptObjCopy",
520 "Termination",
521 "Other",
522 "GCWorkerTotal",
523 "GCWorkerEnd",
524 "StringDedupQueueFixup",
525 "StringDedupTableFixup",
526 "RedirtyCards",
527 "YoungFreeCSet",
528 "NonYoungFreeCSet"
529 //GCParPhasesSentinel only used to tell end of enum
530 };
531
532 STATIC_ASSERT(ARRAY_SIZE(names) == G1GCPhaseTimes::GCParPhasesSentinel); // GCParPhases enum and corresponding string array should have the same "length", this tries to assert it
533
534 return names[phase];
535 }
536
537 G1EvacPhaseWithTrimTimeTracker::G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time) :
|
43 _max_gc_threads(max_gc_threads),
44 _gc_start_counter(0),
45 _gc_pause_time_ms(0.0),
46 _ref_phase_times(gc_timer, max_gc_threads),
47 _weak_phase_times(max_gc_threads)
48 {
49 assert(max_gc_threads > 0, "Must have some GC threads");
50
51 _gc_par_phases[GCWorkerStart] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Start (ms):");
52 _gc_par_phases[ExtRootScan] = new WorkerDataArray<double>(max_gc_threads, "Ext Root Scanning (ms):");
53
54 // Root scanning phases
55 _gc_par_phases[ThreadRoots] = new WorkerDataArray<double>(max_gc_threads, "Thread Roots (ms):");
56 _gc_par_phases[UniverseRoots] = new WorkerDataArray<double>(max_gc_threads, "Universe Roots (ms):");
57 _gc_par_phases[JNIRoots] = new WorkerDataArray<double>(max_gc_threads, "JNI Handles Roots (ms):");
58 _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>(max_gc_threads, "ObjectSynchronizer Roots (ms):");
59 _gc_par_phases[ManagementRoots] = new WorkerDataArray<double>(max_gc_threads, "Management Roots (ms):");
60 _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>(max_gc_threads, "SystemDictionary Roots (ms):");
61 _gc_par_phases[CLDGRoots] = new WorkerDataArray<double>(max_gc_threads, "CLDG Roots (ms):");
62 _gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>(max_gc_threads, "JVMTI Roots (ms):");
63 #if INCLUDE_AOT
64 _gc_par_phases[AOTCodeRoots] = new WorkerDataArray<double>(max_gc_threads, "AOT Root Scan (ms):");
65 #endif
66 _gc_par_phases[CMRefRoots] = new WorkerDataArray<double>(max_gc_threads, "CM RefProcessor Roots (ms):");
67 _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong CLD (ms):");
68 _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms):");
69 _gc_par_phases[SATBFiltering] = new WorkerDataArray<double>(max_gc_threads, "SATB Filtering (ms):");
70
71 _gc_par_phases[UpdateRS] = new WorkerDataArray<double>(max_gc_threads, "Update RS (ms):");
72 if (G1HotCardCache::default_use_cache()) {
73 _gc_par_phases[ScanHCC] = new WorkerDataArray<double>(max_gc_threads, "Scan HCC (ms):");
74 } else {
75 _gc_par_phases[ScanHCC] = NULL;
76 }
77 _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS (ms):");
78 _gc_par_phases[OptScanRS] = new WorkerDataArray<double>(max_gc_threads, "Optional Scan RS (ms):");
79 _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning (ms):");
80 _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy (ms):");
81 _gc_par_phases[OptObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Optional Object Copy (ms):");
82 _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination (ms):");
83 _gc_par_phases[GCWorkerTotal] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Total (ms):");
84 _gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>(max_gc_threads, "GC Worker End (ms):");
85 _gc_par_phases[Other] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Other (ms):");
86
87 _scan_rs_scanned_cards = new WorkerDataArray<size_t>(max_gc_threads, "Scanned Cards:");
88 _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_scanned_cards, ScanRSScannedCards);
89 _scan_rs_claimed_cards = new WorkerDataArray<size_t>(max_gc_threads, "Claimed Cards:");
90 _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_claimed_cards, ScanRSClaimedCards);
91 _scan_rs_skipped_cards = new WorkerDataArray<size_t>(max_gc_threads, "Skipped Cards:");
92 _gc_par_phases[ScanRS]->link_thread_work_items(_scan_rs_skipped_cards, ScanRSSkippedCards);
93
94 _opt_cset_scanned_cards = new WorkerDataArray<size_t>(max_gc_threads, "Scanned Cards:");
95 _gc_par_phases[OptScanRS]->link_thread_work_items(_opt_cset_scanned_cards, OptCSetScannedCards);
96 _opt_cset_claimed_cards = new WorkerDataArray<size_t>(max_gc_threads, "Claimed Cards:");
97 _gc_par_phases[OptScanRS]->link_thread_work_items(_opt_cset_claimed_cards, OptCSetClaimedCards);
98 _opt_cset_skipped_cards = new WorkerDataArray<size_t>(max_gc_threads, "Skipped Cards:");
99 _gc_par_phases[OptScanRS]->link_thread_work_items(_opt_cset_skipped_cards, OptCSetSkippedCards);
372 }
373 return sum_ms;
374 }
375
376 double G1GCPhaseTimes::print_evacuate_collection_set() const {
377 const double sum_ms = _cur_collection_par_time_ms;
378
379 info_time("Evacuate Collection Set", sum_ms);
380
381 trace_phase(_gc_par_phases[GCWorkerStart], false);
382 debug_phase(_gc_par_phases[ExtRootScan]);
383 for (int i = ThreadRoots; i <= SATBFiltering; i++) {
384 trace_phase(_gc_par_phases[i]);
385 }
386 debug_phase(_gc_par_phases[UpdateRS]);
387 if (G1HotCardCache::default_use_cache()) {
388 trace_phase(_gc_par_phases[ScanHCC]);
389 }
390 debug_phase(_gc_par_phases[ScanRS]);
391 debug_phase(_gc_par_phases[CodeRoots]);
392 debug_phase(_gc_par_phases[ObjCopy]);
393 debug_phase(_gc_par_phases[Termination]);
394 debug_phase(_gc_par_phases[Other]);
395 debug_phase(_gc_par_phases[GCWorkerTotal]);
396 trace_phase(_gc_par_phases[GCWorkerEnd], false);
397
398 return sum_ms;
399 }
400
401 double G1GCPhaseTimes::print_post_evacuate_collection_set() const {
402 const double evac_fail_handling = _cur_evac_fail_recalc_used +
403 _cur_evac_fail_remove_self_forwards;
404 const double sum_ms = evac_fail_handling +
405 _cur_collection_code_root_fixup_time_ms +
406 _recorded_preserve_cm_referents_time_ms +
407 _cur_ref_proc_time_ms +
408 (_weak_phase_times.total_time_sec() * MILLIUNITS) +
409 _cur_clear_ct_time_ms +
410 _recorded_merge_pss_time_ms +
411 _cur_strong_code_root_purge_time_ms +
483 accounted_ms += print_post_evacuate_collection_set();
484 print_other(accounted_ms);
485
486 if (_cur_verify_after_time_ms > 0.0) {
487 debug_time("Verify After", _cur_verify_after_time_ms);
488 }
489 }
490
491 const char* G1GCPhaseTimes::phase_name(GCParPhases phase) {
492 static const char* names[] = {
493 "GCWorkerStart",
494 "ExtRootScan",
495 "ThreadRoots",
496 "UniverseRoots",
497 "JNIRoots",
498 "ObjectSynchronizerRoots",
499 "ManagementRoots",
500 "SystemDictionaryRoots",
501 "CLDGRoots",
502 "JVMTIRoots",
503 #if INCLUDE_AOT
504 "AOTCodeRoots",
505 #endif
506 "CMRefRoots",
507 "WaitForStrongCLD",
508 "WeakCLDRoots",
509 "SATBFiltering",
510 "UpdateRS",
511 "ScanHCC",
512 "ScanRS",
513 "OptScanRS",
514 "CodeRoots",
515 "ObjCopy",
516 "OptObjCopy",
517 "Termination",
518 "Other",
519 "GCWorkerTotal",
520 "GCWorkerEnd",
521 "StringDedupQueueFixup",
522 "StringDedupTableFixup",
523 "RedirtyCards",
524 "YoungFreeCSet",
525 "NonYoungFreeCSet"
526 //GCParPhasesSentinel only used to tell end of enum
527 };
528
529 STATIC_ASSERT(ARRAY_SIZE(names) == G1GCPhaseTimes::GCParPhasesSentinel); // GCParPhases enum and corresponding string array should have the same "length", this tries to assert it
530
531 return names[phase];
532 }
533
534 G1EvacPhaseWithTrimTimeTracker::G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time) :
|