< prev index next >

src/hotspot/share/gc/g1/g1YoungRemSetSamplingThread.cpp

Print this page




 148     if (_regions_visited == 10) {
 149       if (_sts->should_yield()) {
 150         _sts->yield();
 151         // A gc may have occurred and our sampling data is stale and further
 152         // traversal of the collection set is unsafe
 153         return true;
 154       }
 155       _regions_visited = 0;
 156     }
 157     return false;
 158   }
 159 
 160   size_t sampled_rs_lengths() const { return _sampled_rs_lengths; }
 161 };
 162 
 163 void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {
 164   SuspendibleThreadSetJoiner sts;
 165   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 166   G1Policy* policy = g1h->policy();
 167 
 168   if (policy->use_adaptive_young_list_length()) {
 169     G1YoungRemSetSamplingClosure cl(&sts);
 170 
 171     G1CollectionSet* g1cs = g1h->collection_set();
 172     g1cs->iterate(&cl);
 173 
 174     if (cl.is_complete()) {
 175       policy->revise_young_list_target_length_if_necessary(cl.sampled_rs_lengths());
 176     }
 177   }
 178 }


 148     if (_regions_visited == 10) {
 149       if (_sts->should_yield()) {
 150         _sts->yield();
 151         // A gc may have occurred and our sampling data is stale and further
 152         // traversal of the collection set is unsafe
 153         return true;
 154       }
 155       _regions_visited = 0;
 156     }
 157     return false;
 158   }
 159 
 160   size_t sampled_rs_lengths() const { return _sampled_rs_lengths; }
 161 };
 162 
 163 void G1YoungRemSetSamplingThread::sample_young_list_rs_lengths() {
 164   SuspendibleThreadSetJoiner sts;
 165   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 166   G1Policy* policy = g1h->policy();
 167 
 168   if (policy->adaptive_young_list_length()) {
 169     G1YoungRemSetSamplingClosure cl(&sts);
 170 
 171     G1CollectionSet* g1cs = g1h->collection_set();
 172     g1cs->iterate(&cl);
 173 
 174     if (cl.is_complete()) {
 175       policy->revise_young_list_target_length_if_necessary(cl.sampled_rs_lengths());
 176     }
 177   }
 178 }
< prev index next >