Print this page




  81 class KlassInfoTable: public StackObj {
  82  private:
  83   int _size;
  84 
  85   // An aligned reference address (typically the least
  86   // address in the perm gen) used for hashing klass
  87   // objects.
  88   HeapWord* _ref;
  89 
  90   KlassInfoBucket* _buckets;
  91   uint hash(klassOop p);
  92   KlassInfoEntry* lookup(const klassOop k);
  93 
  94  public:
  95   // Table size
  96   enum {
  97     cit_size = 20011
  98   };
  99   KlassInfoTable(int size, HeapWord* ref);
 100   ~KlassInfoTable();
 101   void record_instance(const oop obj);
 102   void iterate(KlassInfoClosure* cic);

 103 };
 104 
 105 class KlassInfoHisto : public StackObj {
 106  private:
 107   GrowableArray<KlassInfoEntry*>* _elements;
 108   GrowableArray<KlassInfoEntry*>* elements() const { return _elements; }
 109   const char* _title;
 110   const char* title() const { return _title; }
 111   static int sort_helper(KlassInfoEntry** e1, KlassInfoEntry** e2);
 112   void print_elements(outputStream* st) const;
 113  public:
 114   enum {
 115     histo_initial_size = 1000
 116   };
 117   KlassInfoHisto(const char* title,
 118              int estimatedCount);
 119   ~KlassInfoHisto();
 120   void add(KlassInfoEntry* cie);
 121   void print_on(outputStream* st) const;
 122   void sort();


  81 class KlassInfoTable: public StackObj {
  82  private:
  83   int _size;
  84 
  85   // An aligned reference address (typically the least
  86   // address in the perm gen) used for hashing klass
  87   // objects.
  88   HeapWord* _ref;
  89 
  90   KlassInfoBucket* _buckets;
  91   uint hash(klassOop p);
  92   KlassInfoEntry* lookup(const klassOop k);
  93 
  94  public:
  95   // Table size
  96   enum {
  97     cit_size = 20011
  98   };
  99   KlassInfoTable(int size, HeapWord* ref);
 100   ~KlassInfoTable();
 101   bool record_instance(const oop obj);
 102   void iterate(KlassInfoClosure* cic);
 103   bool allocation_failed() { return _buckets == NULL; }
 104 };
 105 
 106 class KlassInfoHisto : public StackObj {
 107  private:
 108   GrowableArray<KlassInfoEntry*>* _elements;
 109   GrowableArray<KlassInfoEntry*>* elements() const { return _elements; }
 110   const char* _title;
 111   const char* title() const { return _title; }
 112   static int sort_helper(KlassInfoEntry** e1, KlassInfoEntry** e2);
 113   void print_elements(outputStream* st) const;
 114  public:
 115   enum {
 116     histo_initial_size = 1000
 117   };
 118   KlassInfoHisto(const char* title,
 119              int estimatedCount);
 120   ~KlassInfoHisto();
 121   void add(KlassInfoEntry* cie);
 122   void print_on(outputStream* st) const;
 123   void sort();