src/hotspot/share/gc/g1/g1ConcurrentRefineThread.cpp
changeset 58508 d6058bd73982
parent 57953 d78c910f9069
child 58679 9c3209ff7550
equal deleted inserted replaced
58507:7c1d0616828c 58508:d6058bd73982
    35 
    35 
    36 G1ConcurrentRefineThread::G1ConcurrentRefineThread(G1ConcurrentRefine* cr, uint worker_id) :
    36 G1ConcurrentRefineThread::G1ConcurrentRefineThread(G1ConcurrentRefine* cr, uint worker_id) :
    37   ConcurrentGCThread(),
    37   ConcurrentGCThread(),
    38   _vtime_start(0.0),
    38   _vtime_start(0.0),
    39   _vtime_accum(0.0),
    39   _vtime_accum(0.0),
       
    40   _total_refinement_time(),
       
    41   _total_refined_cards(0),
    40   _worker_id(worker_id),
    42   _worker_id(worker_id),
    41   _active(false),
    43   _active(false),
    42   _monitor(NULL),
    44   _monitor(NULL),
    43   _cr(cr)
    45   _cr(cr)
    44 {
    46 {
    99     wait_for_completed_buffers();
   101     wait_for_completed_buffers();
   100     if (should_terminate()) {
   102     if (should_terminate()) {
   101       break;
   103       break;
   102     }
   104     }
   103 
   105 
   104     size_t buffers_processed = 0;
       
   105     log_debug(gc, refine)("Activated worker %d, on threshold: " SIZE_FORMAT ", current: " SIZE_FORMAT,
   106     log_debug(gc, refine)("Activated worker %d, on threshold: " SIZE_FORMAT ", current: " SIZE_FORMAT,
   106                           _worker_id, _cr->activation_threshold(_worker_id),
   107                           _worker_id, _cr->activation_threshold(_worker_id),
   107                           G1BarrierSet::dirty_card_queue_set().num_cards());
   108                           G1BarrierSet::dirty_card_queue_set().num_cards());
       
   109 
       
   110     size_t start_total_refined_cards = _total_refined_cards; // For logging.
   108 
   111 
   109     {
   112     {
   110       SuspendibleThreadSetJoiner sts_join;
   113       SuspendibleThreadSetJoiner sts_join;
   111 
   114 
   112       while (!should_terminate()) {
   115       while (!should_terminate()) {
   113         if (sts_join.should_yield()) {
   116         if (sts_join.should_yield()) {
   114           sts_join.yield();
   117           sts_join.yield();
   115           continue;             // Re-check for termination after yield delay.
   118           continue;             // Re-check for termination after yield delay.
   116         }
   119         }
   117 
   120 
   118         if (!_cr->do_refinement_step(_worker_id)) {
   121         Ticks start_time = Ticks::now();
   119           break;
   122         if (!_cr->do_refinement_step(_worker_id, &_total_refined_cards)) {
       
   123           break;                // No cards to process.
   120         }
   124         }
   121         ++buffers_processed;
   125         _total_refinement_time += (Ticks::now() - start_time);
   122       }
   126       }
   123     }
   127     }
   124 
   128 
   125     deactivate();
   129     deactivate();
   126     log_debug(gc, refine)("Deactivated worker %d, off threshold: " SIZE_FORMAT
   130     log_debug(gc, refine)("Deactivated worker %d, off threshold: " SIZE_FORMAT
   127                           ", current: " SIZE_FORMAT ", buffers processed: "
   131                           ", current: " SIZE_FORMAT ", refined cards: "
   128                           SIZE_FORMAT,
   132                           SIZE_FORMAT ", total refined cards: " SIZE_FORMAT,
   129                           _worker_id, _cr->deactivation_threshold(_worker_id),
   133                           _worker_id, _cr->deactivation_threshold(_worker_id),
   130                           G1BarrierSet::dirty_card_queue_set().num_cards(),
   134                           G1BarrierSet::dirty_card_queue_set().num_cards(),
   131                           buffers_processed);
   135                           _total_refined_cards - start_total_refined_cards,
       
   136                           _total_refined_cards);
   132 
   137 
   133     if (os::supports_vtime()) {
   138     if (os::supports_vtime()) {
   134       _vtime_accum = (os::elapsedVTime() - _vtime_start);
   139       _vtime_accum = (os::elapsedVTime() - _vtime_start);
   135     } else {
   140     } else {
   136       _vtime_accum = 0.0;
   141       _vtime_accum = 0.0;