src/share/vm/memory/heapInspection.hpp
Print this page
rev 4303 : 8010294: Refactor HeapInspection to make it more reusable
@@ -83,10 +83,11 @@
};
class KlassInfoTable: public StackObj {
private:
int _size;
+ static const int _num_buckets = 20011;
// An aligned reference address (typically the least
// address in the perm gen) used for hashing klass
// objects.
HeapWord* _ref;
@@ -94,15 +95,11 @@
KlassInfoBucket* _buckets;
uint hash(klassOop p);
KlassInfoEntry* lookup(const klassOop k);
public:
- // Table size
- enum {
- cit_size = 20011
- };
- KlassInfoTable(int size, HeapWord* ref);
+ KlassInfoTable(HeapWord* ref);
~KlassInfoTable();
bool record_instance(const oop obj);
void iterate(KlassInfoClosure* cic);
bool allocation_failed() { return _buckets == NULL; }
};
@@ -113,25 +110,31 @@
GrowableArray<KlassInfoEntry*>* elements() const { return _elements; }
const char* _title;
const char* title() const { return _title; }
static int sort_helper(KlassInfoEntry** e1, KlassInfoEntry** e2);
void print_elements(outputStream* st) const;
+ static const int _histo_initial_size = 1000;
public:
- enum {
- histo_initial_size = 1000
- };
- KlassInfoHisto(const char* title,
- int estimatedCount);
+ KlassInfoHisto(const char* title);
~KlassInfoHisto();
void add(KlassInfoEntry* cie);
void print_on(outputStream* st) const;
void sort();
};
class HeapInspection : public AllStatic {
public:
static void heap_inspection(outputStream* st, bool need_prologue);
+ static size_t instance_inspection(KlassInfoTable* cit,
+ KlassInfoClosure* cl,
+ bool need_prologue,
+ BoolObjectClosure* filter = NULL);
+ static HeapWord* start_of_perm_gen();
static void find_instances_at_safepoint(klassOop k, GrowableArray<oop>* result);
+ private:
+ static bool is_shared_heap();
+ static void prologue();
+ static void epilogue();
};
#endif // SHARE_VM_MEMORY_HEAPINSPECTION_HPP