< prev index next >

src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp

Print this page




3555   }
3556 
3557   ~PrintRSetsClosure() {
3558     gclog_or_tty->print_cr("Occupied Sum: " SIZE_FORMAT, _occupied_sum);
3559     gclog_or_tty->print_cr("========================================");
3560     gclog_or_tty->cr();
3561   }
3562 };
3563 
3564 void G1CollectedHeap::print_cset_rsets() {
3565   PrintRSetsClosure cl("Printing CSet RSets");
3566   collection_set_iterate(&cl);
3567 }
3568 
3569 void G1CollectedHeap::print_all_rsets() {
3570   PrintRSetsClosure cl("Printing All RSets");;
3571   heap_region_iterate(&cl);
3572 }
3573 #endif // PRODUCT
3574 






















3575 G1CollectedHeap* G1CollectedHeap::heap() {
3576   assert(_sh->kind() == CollectedHeap::G1CollectedHeap,
3577          "not a garbage-first heap");
3578   return _g1h;
3579 }
3580 
3581 void G1CollectedHeap::gc_prologue(bool full /* Ignored */) {
3582   // always_do_update_barrier = false;
3583   assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
3584   // Fill TLAB's and such
3585   accumulate_statistics_all_tlabs();
3586   ensure_parsability(true);
3587 
3588   if (G1SummarizeRSetStats && (G1SummarizeRSetStatsPeriod > 0) &&
3589       (total_collections() % G1SummarizeRSetStatsPeriod == 0)) {
3590     g1_rem_set()->print_periodic_summary_info("Before GC RS summary");
3591   }
3592 }
3593 
3594 void G1CollectedHeap::gc_epilogue(bool full) {


4072         // region(s) so that all the ALLOC / RETIRE events are generated
4073         // before the start GC event.
4074         _hr_printer.start_gc(false /* full */, (size_t) total_collections());
4075 
4076         // This timing is only used by the ergonomics to handle our pause target.
4077         // It is unclear why this should not include the full pause. We will
4078         // investigate this in CR 7178365.
4079         //
4080         // Preserving the old comment here if that helps the investigation:
4081         //
4082         // The elapsed time induced by the start time below deliberately elides
4083         // the possible verification above.
4084         double sample_start_time_sec = os::elapsedTime();
4085 
4086 #if YOUNG_LIST_VERBOSE
4087         gclog_or_tty->print_cr("\nBefore recording pause start.\nYoung_list:");
4088         _young_list->print();
4089         g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);
4090 #endif // YOUNG_LIST_VERBOSE
4091 
4092         g1_policy()->record_collection_pause_start(sample_start_time_sec);
4093 
4094         double scan_wait_start = os::elapsedTime();
4095         // We have to wait until the CM threads finish scanning the
4096         // root regions as it's the only way to ensure that all the
4097         // objects on them have been correctly scanned before we start
4098         // moving them during the GC.
4099         bool waited = _cm->root_regions()->wait_until_scan_finished();
4100         double wait_time_ms = 0.0;
4101         if (waited) {
4102           double scan_wait_end = os::elapsedTime();
4103           wait_time_ms = (scan_wait_end - scan_wait_start) * 1000.0;
4104         }
4105         g1_policy()->phase_times()->record_root_region_scan_wait_time(wait_time_ms);
4106 
4107 #if YOUNG_LIST_VERBOSE
4108         gclog_or_tty->print_cr("\nAfter recording pause start.\nYoung_list:");
4109         _young_list->print();
4110 #endif // YOUNG_LIST_VERBOSE
4111 
4112         if (g1_policy()->during_initial_mark_pause()) {




3555   }
3556 
3557   ~PrintRSetsClosure() {
3558     gclog_or_tty->print_cr("Occupied Sum: " SIZE_FORMAT, _occupied_sum);
3559     gclog_or_tty->print_cr("========================================");
3560     gclog_or_tty->cr();
3561   }
3562 };
3563 
3564 void G1CollectedHeap::print_cset_rsets() {
3565   PrintRSetsClosure cl("Printing CSet RSets");
3566   collection_set_iterate(&cl);
3567 }
3568 
3569 void G1CollectedHeap::print_all_rsets() {
3570   PrintRSetsClosure cl("Printing All RSets");;
3571   heap_region_iterate(&cl);
3572 }
3573 #endif // PRODUCT
3574 
3575 G1HeapSummary G1CollectedHeap::create_g1_heap_summary() {
3576 
3577   size_t eden_used_bytes = _young_list->eden_used_bytes();
3578   size_t survivor_used_bytes = _young_list->survivor_used_bytes();
3579   size_t heap_used = Heap_lock->owned_by_self() ? used() : used_unlocked();
3580 
3581   size_t eden_capacity_bytes =
3582     (g1_policy()->young_list_target_length() * HeapRegion::GrainBytes) - survivor_used_bytes;
3583 
3584   VirtualSpaceSummary heap_summary = create_heap_space_summary();
3585   return G1HeapSummary(heap_summary, heap_used, eden_used_bytes,
3586                        eden_capacity_bytes, survivor_used_bytes, num_regions());
3587 }
3588 
3589 void G1CollectedHeap::trace_heap(GCWhen::Type when, GCTracer* gc_tracer) {
3590   const G1HeapSummary& heap_summary = create_g1_heap_summary();
3591   gc_tracer->report_gc_heap_summary(when, heap_summary);
3592 
3593   const MetaspaceSummary& metaspace_summary = create_metaspace_summary();
3594   gc_tracer->report_metaspace_summary(when, metaspace_summary);
3595 }
3596 
3597 G1CollectedHeap* G1CollectedHeap::heap() {
3598   assert(_sh->kind() == CollectedHeap::G1CollectedHeap,
3599          "not a garbage-first heap");
3600   return _g1h;
3601 }
3602 
3603 void G1CollectedHeap::gc_prologue(bool full /* Ignored */) {
3604   // always_do_update_barrier = false;
3605   assert(InlineCacheBuffer::is_empty(), "should have cleaned up ICBuffer");
3606   // Fill TLAB's and such
3607   accumulate_statistics_all_tlabs();
3608   ensure_parsability(true);
3609 
3610   if (G1SummarizeRSetStats && (G1SummarizeRSetStatsPeriod > 0) &&
3611       (total_collections() % G1SummarizeRSetStatsPeriod == 0)) {
3612     g1_rem_set()->print_periodic_summary_info("Before GC RS summary");
3613   }
3614 }
3615 
3616 void G1CollectedHeap::gc_epilogue(bool full) {


4094         // region(s) so that all the ALLOC / RETIRE events are generated
4095         // before the start GC event.
4096         _hr_printer.start_gc(false /* full */, (size_t) total_collections());
4097 
4098         // This timing is only used by the ergonomics to handle our pause target.
4099         // It is unclear why this should not include the full pause. We will
4100         // investigate this in CR 7178365.
4101         //
4102         // Preserving the old comment here if that helps the investigation:
4103         //
4104         // The elapsed time induced by the start time below deliberately elides
4105         // the possible verification above.
4106         double sample_start_time_sec = os::elapsedTime();
4107 
4108 #if YOUNG_LIST_VERBOSE
4109         gclog_or_tty->print_cr("\nBefore recording pause start.\nYoung_list:");
4110         _young_list->print();
4111         g1_policy()->print_collection_set(g1_policy()->inc_cset_head(), gclog_or_tty);
4112 #endif // YOUNG_LIST_VERBOSE
4113 
4114         g1_policy()->record_collection_pause_start(sample_start_time_sec, *_gc_tracer_stw);
4115 
4116         double scan_wait_start = os::elapsedTime();
4117         // We have to wait until the CM threads finish scanning the
4118         // root regions as it's the only way to ensure that all the
4119         // objects on them have been correctly scanned before we start
4120         // moving them during the GC.
4121         bool waited = _cm->root_regions()->wait_until_scan_finished();
4122         double wait_time_ms = 0.0;
4123         if (waited) {
4124           double scan_wait_end = os::elapsedTime();
4125           wait_time_ms = (scan_wait_end - scan_wait_start) * 1000.0;
4126         }
4127         g1_policy()->phase_times()->record_root_region_scan_wait_time(wait_time_ms);
4128 
4129 #if YOUNG_LIST_VERBOSE
4130         gclog_or_tty->print_cr("\nAfter recording pause start.\nYoung_list:");
4131         _young_list->print();
4132 #endif // YOUNG_LIST_VERBOSE
4133 
4134         if (g1_policy()->during_initial_mark_pause()) {


< prev index next >