200 } 201 202 public: 203 KlassInfoHisto(KlassInfoTable* cit); 204 ~KlassInfoHisto(); 205 void add(KlassInfoEntry* cie); 206 void print_histo_on(outputStream* st); 207 void sort(); 208 }; 209 210 #endif // INCLUDE_SERVICES 211 212 // These declarations are needed since the declaration of KlassInfoTable and 213 // KlassInfoClosure are guarded by #if INLCUDE_SERVICES 214 class KlassInfoTable; 215 class KlassInfoClosure; 216 217 class HeapInspection : public StackObj { 218 public: 219 void heap_inspection(outputStream* st, uint parallel_thread_num = 1) NOT_SERVICES_RETURN; 220 uint populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL, uint parallel_thread_num = 1) NOT_SERVICES_RETURN_(0); 221 static void find_instances_at_safepoint(Klass* k, GrowableArray<oop>* result) NOT_SERVICES_RETURN; 222 private: 223 void iterate_over_heap(KlassInfoTable* cit, BoolObjectClosure* filter = NULL); 224 }; 225 226 // Parallel heap inspection task. Parallel inspection can fail due to 227 // a native OOM when allocating memory for TL-KlassInfoTable. 228 // _success will be set false on an OOM, and serial inspection tried. 229 class ParHeapInspectTask : public AbstractGangTask { 230 private: 231 ParallelObjectIterator* _poi; 232 KlassInfoTable* _shared_cit; 233 BoolObjectClosure* _filter; 234 uint _missed_count; 235 bool _success; 236 Mutex _mutex; 237 238 public: 239 ParHeapInspectTask(ParallelObjectIterator* poi, 240 KlassInfoTable* shared_cit, 241 BoolObjectClosure* filter) : 242 AbstractGangTask("Iterating heap"), 243 _poi(poi), 244 _shared_cit(shared_cit), 245 _filter(filter), 246 _missed_count(0), 247 _success(true), 248 _mutex(Mutex::leaf, "Parallel heap iteration data merge lock") {} 249 250 uint missed_count() const { 251 return _missed_count; 252 } 253 254 bool success() { 255 return _success; 256 } 257 258 virtual void work(uint worker_id); 259 }; 260 261 262 263 #endif // SHARE_MEMORY_HEAPINSPECTION_HPP | 200 } 201 202 public: 203 KlassInfoHisto(KlassInfoTable* cit); 204 ~KlassInfoHisto(); 205 void add(KlassInfoEntry* cie); 206 void print_histo_on(outputStream* st); 207 void sort(); 208 }; 209 210 #endif // INCLUDE_SERVICES 211 212 // These declarations are needed since the declaration of KlassInfoTable and 213 // KlassInfoClosure are guarded by #if INLCUDE_SERVICES 214 class KlassInfoTable; 215 class KlassInfoClosure; 216 217 class HeapInspection : public StackObj { 218 public: 219 void heap_inspection(outputStream* st, uint parallel_thread_num = 1) NOT_SERVICES_RETURN; 220 uintx populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL, uint parallel_thread_num = 1) NOT_SERVICES_RETURN_(0); 221 static void find_instances_at_safepoint(Klass* k, GrowableArray<oop>* result) NOT_SERVICES_RETURN; 222 private: 223 void iterate_over_heap(KlassInfoTable* cit, BoolObjectClosure* filter = NULL); 224 }; 225 226 // Parallel heap inspection task. Parallel inspection can fail due to 227 // a native OOM when allocating memory for TL-KlassInfoTable. 228 // _success will be set false on an OOM, and serial inspection tried. 229 class ParHeapInspectTask : public AbstractGangTask { 230 private: 231 ParallelObjectIterator* _poi; 232 KlassInfoTable* _shared_cit; 233 BoolObjectClosure* _filter; 234 uintx _missed_count; 235 bool _success; 236 Mutex _mutex; 237 238 public: 239 ParHeapInspectTask(ParallelObjectIterator* poi, 240 KlassInfoTable* shared_cit, 241 BoolObjectClosure* filter) : 242 AbstractGangTask("Iterating heap"), 243 _poi(poi), 244 _shared_cit(shared_cit), 245 _filter(filter), 246 _missed_count(0), 247 _success(true), 248 _mutex(Mutex::leaf, "Parallel heap iteration data merge lock") {} 249 250 uintx missed_count() const { 251 return _missed_count; 252 } 253 254 bool success() { 255 return _success; 256 } 257 258 virtual void work(uint worker_id); 259 }; 260 261 262 263 #endif // SHARE_MEMORY_HEAPINSPECTION_HPP |