< prev index next >

src/hotspot/share/memory/heapInspection.cpp

Print this page




 558   }
 559   RecordInstanceClosure ric(&cit, _filter);
 560   _poi->object_iterate(&ric, worker_id);
 561   missed_count = ric.missed_count();
 562   {
 563     MutexLocker x(&_mutex);
 564     merge_success = _shared_cit->merge(&cit);
 565   }
 566   if (merge_success) {
 567     Atomic::add(&_missed_count, missed_count);
 568   } else {
 569     Atomic::store(&_success, false);
 570   }
 571 }
 572 
 573 uintx HeapInspection::populate_table(KlassInfoTable* cit, BoolObjectClosure *filter, uint parallel_thread_num) {
 574 
 575   // Try parallel first.
 576   if (parallel_thread_num > 1) {
 577     ResourceMark rm;
 578     ParallelObjectIterator* poi = Universe::heap()->parallel_object_iterator(parallel_thread_num);
 579     if (poi != NULL) {
 580       ParHeapInspectTask task(poi, cit, filter);
 581       Universe::heap()->run_task_at_safepoint(&task, parallel_thread_num);
 582       delete poi;
 583       if (task.success()) {
 584         return task.missed_count();













 585       }
 586     }
 587   }
 588 
 589   ResourceMark rm;
 590   // If no parallel iteration available, run serially.
 591   RecordInstanceClosure ric(cit, filter);
 592   Universe::heap()->object_iterate(&ric);
 593   return ric.missed_count();
 594 }
 595 
 596 void HeapInspection::heap_inspection(outputStream* st, uint parallel_thread_num) {
 597   ResourceMark rm;
 598 
 599   KlassInfoTable cit(false);
 600   if (!cit.allocation_failed()) {
 601     // populate table with object allocation info
 602     uintx missed_count = populate_table(&cit, NULL, parallel_thread_num);
 603     if (missed_count != 0) {
 604       log_info(gc, classhisto)("WARNING: Ran out of C-heap; undercounted " UINTX_FORMAT




 558   }
 559   RecordInstanceClosure ric(&cit, _filter);
 560   _poi->object_iterate(&ric, worker_id);
 561   missed_count = ric.missed_count();
 562   {
 563     MutexLocker x(&_mutex);
 564     merge_success = _shared_cit->merge(&cit);
 565   }
 566   if (merge_success) {
 567     Atomic::add(&_missed_count, missed_count);
 568   } else {
 569     Atomic::store(&_success, false);
 570   }
 571 }
 572 
 573 uintx HeapInspection::populate_table(KlassInfoTable* cit, BoolObjectClosure *filter, uint parallel_thread_num) {
 574 
 575   // Try parallel first.
 576   if (parallel_thread_num > 1) {
 577     ResourceMark rm;
 578 
 579     WorkGang* gang = Universe::heap()->get_safepoint_workers();
 580     if (gang != NULL) {
 581       // The GC provided a WorkGang to be used during a safepoint.
 582 
 583       // Can't run with more threads than provided by the WorkGang.
 584       WithUpdatedActiveWorkers update_and_restore(gang, parallel_thread_num);
 585 
 586       ParallelObjectIterator* poi = Universe::heap()->parallel_object_iterator(gang->active_workers());
 587       if (poi != NULL) {
 588         // The GC supports parallel object iteration.
 589 
 590         ParHeapInspectTask task(poi, cit, filter);
 591         // Run task with the active workers.
 592         gang->run_task(&task);
 593 
 594         delete poi;
 595         if (task.success()) {
 596           return task.missed_count();
 597         }
 598       }
 599     }
 600   }
 601 
 602   ResourceMark rm;
 603   // If no parallel iteration available, run serially.
 604   RecordInstanceClosure ric(cit, filter);
 605   Universe::heap()->object_iterate(&ric);
 606   return ric.missed_count();
 607 }
 608 
 609 void HeapInspection::heap_inspection(outputStream* st, uint parallel_thread_num) {
 610   ResourceMark rm;
 611 
 612   KlassInfoTable cit(false);
 613   if (!cit.allocation_failed()) {
 614     // populate table with object allocation info
 615     uintx missed_count = populate_table(&cit, NULL, parallel_thread_num);
 616     if (missed_count != 0) {
 617       log_info(gc, classhisto)("WARNING: Ran out of C-heap; undercounted " UINTX_FORMAT


< prev index next >