< prev index next >

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

Print this page
rev 13061 : imported patch 8178148-more-detailed-scan-rs-logging


3257             size_t bytes_before = capacity();
3258             // No need for an ergo logging here,
3259             // expansion_amount() does this when it returns a value > 0.
3260             double expand_ms;
3261             if (!expand(expand_bytes, _workers, &expand_ms)) {
3262               // We failed to expand the heap. Cannot do anything about it.
3263             }
3264             g1_policy()->phase_times()->record_expand_heap_time(expand_ms);
3265           }
3266         }
3267 
3268         // We redo the verification but now wrt to the new CSet which
3269         // has just got initialized after the previous CSet was freed.
3270         _cm->verify_no_cset_oops();
3271 
3272         // This timing is only used by the ergonomics to handle our pause target.
3273         // It is unclear why this should not include the full pause. We will
3274         // investigate this in CR 7178365.
3275         double sample_end_time_sec = os::elapsedTime();
3276         double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
3277         size_t total_cards_scanned = per_thread_states.total_cards_scanned();
3278         g1_policy()->record_collection_pause_end(pause_time_ms, total_cards_scanned, heap_used_bytes_before_gc);
3279 
3280         evacuation_info.set_collectionset_used_before(collection_set()->bytes_used_before());
3281         evacuation_info.set_bytes_copied(g1_policy()->bytes_copied_during_gc());
3282 
3283         MemoryService::track_memory_usage();
3284 
3285         // In prepare_for_verify() below we'll need to scan the deferred
3286         // update buffers to bring the RSets up-to-date if
3287         // G1HRRSFlushLogBuffersOnVerify has been set. While scanning
3288         // the update buffers we'll probably need to scan cards on the
3289         // regions we just allocated to (i.e., the GC alloc
3290         // regions). However, during the last GC we called
3291         // set_saved_mark() on all the GC alloc regions, so card
3292         // scanning might skip the [saved_mark_word()...top()] area of
3293         // those regions (i.e., the area we allocated objects into
3294         // during the last GC). But it shouldn't. Given that
3295         // saved_mark_word() is conditional on whether the GC time stamp
3296         // on the region is current or not, by incrementing the GC time
3297         // stamp here we invalidate all the GC time stamps on all the


3447 
3448     {
3449       ResourceMark rm;
3450       HandleMark   hm;
3451 
3452       ReferenceProcessor*             rp = _g1h->ref_processor_stw();
3453 
3454       G1ParScanThreadState*           pss = _pss->state_for_worker(worker_id);
3455       pss->set_ref_processor(rp);
3456 
3457       double start_strong_roots_sec = os::elapsedTime();
3458 
3459       _root_processor->evacuate_roots(pss->closures(), worker_id);
3460 
3461       G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, pss);
3462 
3463       // We pass a weak code blobs closure to the remembered set scanning because we want to avoid
3464       // treating the nmethods visited to act as roots for concurrent marking.
3465       // We only want to make sure that the oops in the nmethods are adjusted with regard to the
3466       // objects copied by the current evacuation.
3467       size_t cards_scanned = _g1h->g1_rem_set()->oops_into_collection_set_do(&push_heap_rs_cl,
3468                                                                              pss->closures()->weak_codeblobs(),
3469                                                                              worker_id);
3470 
3471       _pss->add_cards_scanned(worker_id, cards_scanned);
3472 
3473       double strong_roots_sec = os::elapsedTime() - start_strong_roots_sec;
3474 
3475       double term_sec = 0.0;
3476       size_t evac_term_attempts = 0;
3477       {
3478         double start = os::elapsedTime();
3479         G1ParEvacuateFollowersClosure evac(_g1h, pss, _queues, &_terminator);
3480         evac.do_void();
3481 
3482         evac_term_attempts = evac.term_attempts();
3483         term_sec = evac.term_time();
3484         double elapsed_sec = os::elapsedTime() - start;
3485         _g1h->g1_policy()->phase_times()->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec);
3486         _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::Termination, worker_id, term_sec);
3487         _g1h->g1_policy()->phase_times()->record_thread_work_item(G1GCPhaseTimes::Termination, worker_id, evac_term_attempts);
3488       }
3489 
3490       assert(pss->queue_is_empty(), "should be empty");
3491 




3257             size_t bytes_before = capacity();
3258             // No need for an ergo logging here,
3259             // expansion_amount() does this when it returns a value > 0.
3260             double expand_ms;
3261             if (!expand(expand_bytes, _workers, &expand_ms)) {
3262               // We failed to expand the heap. Cannot do anything about it.
3263             }
3264             g1_policy()->phase_times()->record_expand_heap_time(expand_ms);
3265           }
3266         }
3267 
3268         // We redo the verification but now wrt to the new CSet which
3269         // has just got initialized after the previous CSet was freed.
3270         _cm->verify_no_cset_oops();
3271 
3272         // This timing is only used by the ergonomics to handle our pause target.
3273         // It is unclear why this should not include the full pause. We will
3274         // investigate this in CR 7178365.
3275         double sample_end_time_sec = os::elapsedTime();
3276         double pause_time_ms = (sample_end_time_sec - sample_start_time_sec) * MILLIUNITS;
3277         size_t total_cards_scanned = g1_policy()->phase_times()->sum_thread_work_items(G1GCPhaseTimes::ScanRS, G1GCPhaseTimes::ScannedCards);
3278         g1_policy()->record_collection_pause_end(pause_time_ms, total_cards_scanned, heap_used_bytes_before_gc);
3279 
3280         evacuation_info.set_collectionset_used_before(collection_set()->bytes_used_before());
3281         evacuation_info.set_bytes_copied(g1_policy()->bytes_copied_during_gc());
3282 
3283         MemoryService::track_memory_usage();
3284 
3285         // In prepare_for_verify() below we'll need to scan the deferred
3286         // update buffers to bring the RSets up-to-date if
3287         // G1HRRSFlushLogBuffersOnVerify has been set. While scanning
3288         // the update buffers we'll probably need to scan cards on the
3289         // regions we just allocated to (i.e., the GC alloc
3290         // regions). However, during the last GC we called
3291         // set_saved_mark() on all the GC alloc regions, so card
3292         // scanning might skip the [saved_mark_word()...top()] area of
3293         // those regions (i.e., the area we allocated objects into
3294         // during the last GC). But it shouldn't. Given that
3295         // saved_mark_word() is conditional on whether the GC time stamp
3296         // on the region is current or not, by incrementing the GC time
3297         // stamp here we invalidate all the GC time stamps on all the


3447 
3448     {
3449       ResourceMark rm;
3450       HandleMark   hm;
3451 
3452       ReferenceProcessor*             rp = _g1h->ref_processor_stw();
3453 
3454       G1ParScanThreadState*           pss = _pss->state_for_worker(worker_id);
3455       pss->set_ref_processor(rp);
3456 
3457       double start_strong_roots_sec = os::elapsedTime();
3458 
3459       _root_processor->evacuate_roots(pss->closures(), worker_id);
3460 
3461       G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, pss);
3462 
3463       // We pass a weak code blobs closure to the remembered set scanning because we want to avoid
3464       // treating the nmethods visited to act as roots for concurrent marking.
3465       // We only want to make sure that the oops in the nmethods are adjusted with regard to the
3466       // objects copied by the current evacuation.
3467       _g1h->g1_rem_set()->oops_into_collection_set_do(&push_heap_rs_cl,
3468                                                       pss->closures()->weak_codeblobs(),
3469                                                       worker_id);


3470 
3471       double strong_roots_sec = os::elapsedTime() - start_strong_roots_sec;
3472 
3473       double term_sec = 0.0;
3474       size_t evac_term_attempts = 0;
3475       {
3476         double start = os::elapsedTime();
3477         G1ParEvacuateFollowersClosure evac(_g1h, pss, _queues, &_terminator);
3478         evac.do_void();
3479 
3480         evac_term_attempts = evac.term_attempts();
3481         term_sec = evac.term_time();
3482         double elapsed_sec = os::elapsedTime() - start;
3483         _g1h->g1_policy()->phase_times()->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec);
3484         _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::Termination, worker_id, term_sec);
3485         _g1h->g1_policy()->phase_times()->record_thread_work_item(G1GCPhaseTimes::Termination, worker_id, evac_term_attempts);
3486       }
3487 
3488       assert(pss->queue_is_empty(), "should be empty");
3489 


< prev index next >