< prev index next >

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

Print this page




1573       _hrSorted(hrSorted), _chunk_size(chunk_size),
1574       _g1(G1CollectedHeap::heap()), _hrclaimer(n_workers) {}
1575 
1576   void work(uint worker_id) {
1577     ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size);
1578     _g1->heap_region_par_iterate(&parKnownGarbageCl, worker_id, &_hrclaimer);
1579   }
1580 };
1581 
1582 uint G1CollectorPolicy::calculate_parallel_work_chunk_size(uint n_workers, uint n_regions) {
1583   assert(n_workers > 0, "Active gc workers should be greater than 0");
1584   const uint overpartition_factor = 4;
1585   const uint min_chunk_size = MAX2(n_regions / n_workers, 1U);
1586   return MAX2(n_regions / (n_workers * overpartition_factor), min_chunk_size);
1587 }
1588 
1589 void
1590 G1CollectorPolicy::record_concurrent_mark_cleanup_end() {
1591   _collectionSetChooser->clear();
1592 
1593   FlexibleWorkGang* workers = _g1->workers();
1594   uint n_workers = workers->active_workers();
1595 
1596   uint n_regions = _g1->num_regions();
1597   uint chunk_size = calculate_parallel_work_chunk_size(n_workers, n_regions);
1598   _collectionSetChooser->prepare_for_par_region_addition(n_workers, n_regions, chunk_size);
1599   ParKnownGarbageTask par_known_garbage_task(_collectionSetChooser, chunk_size, n_workers);
1600   workers->run_task(&par_known_garbage_task);
1601 
1602   _collectionSetChooser->sort_regions();
1603 
1604   double end_sec = os::elapsedTime();
1605   double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0;
1606   _concurrent_mark_cleanup_times_ms->add(elapsed_time_ms);
1607   _cur_mark_stop_world_time_ms += elapsed_time_ms;
1608   _prev_collection_pause_end_ms += elapsed_time_ms;
1609   _mmu_tracker->add_pause(_mark_cleanup_start_sec, end_sec, true);
1610 }
1611 
1612 // Add the heap region at the head of the non-incremental collection set
1613 void G1CollectorPolicy::add_old_region_to_cset(HeapRegion* hr) {




1573       _hrSorted(hrSorted), _chunk_size(chunk_size),
1574       _g1(G1CollectedHeap::heap()), _hrclaimer(n_workers) {}
1575 
1576   void work(uint worker_id) {
1577     ParKnownGarbageHRClosure parKnownGarbageCl(_hrSorted, _chunk_size);
1578     _g1->heap_region_par_iterate(&parKnownGarbageCl, worker_id, &_hrclaimer);
1579   }
1580 };
1581 
1582 uint G1CollectorPolicy::calculate_parallel_work_chunk_size(uint n_workers, uint n_regions) {
1583   assert(n_workers > 0, "Active gc workers should be greater than 0");
1584   const uint overpartition_factor = 4;
1585   const uint min_chunk_size = MAX2(n_regions / n_workers, 1U);
1586   return MAX2(n_regions / (n_workers * overpartition_factor), min_chunk_size);
1587 }
1588 
1589 void
1590 G1CollectorPolicy::record_concurrent_mark_cleanup_end() {
1591   _collectionSetChooser->clear();
1592 
1593   WorkGang* workers = _g1->workers();
1594   uint n_workers = workers->active_workers();
1595 
1596   uint n_regions = _g1->num_regions();
1597   uint chunk_size = calculate_parallel_work_chunk_size(n_workers, n_regions);
1598   _collectionSetChooser->prepare_for_par_region_addition(n_workers, n_regions, chunk_size);
1599   ParKnownGarbageTask par_known_garbage_task(_collectionSetChooser, chunk_size, n_workers);
1600   workers->run_task(&par_known_garbage_task);
1601 
1602   _collectionSetChooser->sort_regions();
1603 
1604   double end_sec = os::elapsedTime();
1605   double elapsed_time_ms = (end_sec - _mark_cleanup_start_sec) * 1000.0;
1606   _concurrent_mark_cleanup_times_ms->add(elapsed_time_ms);
1607   _cur_mark_stop_world_time_ms += elapsed_time_ms;
1608   _prev_collection_pause_end_ms += elapsed_time_ms;
1609   _mmu_tracker->add_pause(_mark_cleanup_start_sec, end_sec, true);
1610 }
1611 
1612 // Add the heap region at the head of the non-incremental collection set
1613 void G1CollectorPolicy::add_old_region_to_cset(HeapRegion* hr) {


< prev index next >