199 return w + 1; 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, size_t parallel_thread_num = 1) NOT_SERVICES_RETURN; 220 size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL, size_t 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 // Task for parallel heap inspection. The parallel inspection can be fail 227 // because of native OOM when allocation memory for TL-KlassInfoTable, it 228 // will set success to false when OOM so serial inspection can be tried. 229 // see work() implementation at heapInspection.cpp for more info. 230 class ParHeapInspectTask : public AbstractGangTask { 231 private: 232 ParallelObjectIterator* _poi; 233 KlassInfoTable* _shared_cit; 234 BoolObjectClosure* _filter; 235 size_t _shared_missed_count; 236 bool _success; 237 Mutex _mutex; 238 239 public: 240 ParHeapInspectTask(ParallelObjectIterator* poi, 241 KlassInfoTable* shared_cit, 242 BoolObjectClosure* filter) : 243 AbstractGangTask("Iterating heap"), 244 _poi(poi), 245 _shared_cit(shared_cit), 246 _filter(filter), 247 _shared_missed_count(0), 248 _success(true), 249 _mutex(Mutex::leaf, "Parallel heap iteration data merge lock") {} 250 251 uint missed_count() const { 252 return _shared_missed_count; 253 } 254 255 bool success() { 256 return _success; 257 } 258 259 virtual void work(uint worker_id); 260 }; 261 262 263 264 #endif // SHARE_MEMORY_HEAPINSPECTION_HPP | 199 return w + 1; 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 size_t 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 |