< prev index next >

src/share/vm/memory/heapInspection.hpp

Print this page




 264   friend class KlassHierarchy;
 265 };
 266 
 267 class KlassHierarchy : AllStatic {
 268  public:
 269   static void print_class_hierarchy(outputStream* st, bool print_interfaces,  bool print_subclasses,
 270                                     char* classname);
 271 
 272  private:
 273   static void set_do_print_for_class_hierarchy(KlassInfoEntry* cie, KlassInfoTable* cit,
 274                                                bool print_subclasse);
 275   static void print_class(outputStream* st, KlassInfoEntry* cie, bool print_subclasses);
 276 };
 277 
 278 class KlassInfoHisto : public StackObj {
 279  private:
 280   static const int _histo_initial_size = 1000;
 281   KlassInfoTable *_cit;
 282   GrowableArray<KlassInfoEntry*>* _elements;
 283   GrowableArray<KlassInfoEntry*>* elements() const { return _elements; }
 284   const char* _title;
 285   const char* title() const { return _title; }
 286   static int sort_helper(KlassInfoEntry** e1, KlassInfoEntry** e2);
 287   void print_elements(outputStream* st) const;
 288   void print_class_stats(outputStream* st, bool csv_format, const char *columns);
 289   julong annotations_bytes(Array<AnnotationArray*>* p) const;
 290   const char *_selected_columns;
 291   bool is_selected(const char *col_name);
 292   void print_title(outputStream* st, bool csv_format,
 293                    bool selected_columns_table[], int width_table[],
 294                    const char *name_table[]);
 295 
 296   template <class T> static int count_bytes(T* x) {
 297     return (HeapWordSize * ((x) ? (x)->size() : 0));
 298   }
 299 
 300   template <class T> static int count_bytes_array(T* x) {
 301     if (x == NULL) {
 302       return 0;
 303     }
 304     if (x->length() == 0) {
 305       // This is a shared array, e.g., Universe::the_empty_int_array(). Don't


 323     }
 324     int w = 0;
 325     while (n > 0) {
 326       n /= 10;
 327       w += 1;
 328     }
 329     return w;
 330   }
 331 
 332   static int col_width(julong n, const char *name) {
 333     int w = julong_width(n);
 334     int min = (int)(strlen(name));
 335     if (w < min) {
 336         w = min;
 337     }
 338     // add a leading space for separation.
 339     return w + 1;
 340   }
 341 
 342  public:
 343   KlassInfoHisto(KlassInfoTable* cit, const char* title);
 344   ~KlassInfoHisto();
 345   void add(KlassInfoEntry* cie);
 346   void print_histo_on(outputStream* st, bool print_class_stats, bool csv_format, const char *columns);
 347   void sort();
 348 };
 349 
 350 #endif // INCLUDE_SERVICES
 351 
 352 // These declarations are needed since the declaration of KlassInfoTable and
 353 // KlassInfoClosure are guarded by #if INLCUDE_SERVICES
 354 class KlassInfoTable;
 355 class KlassInfoClosure;
 356 
 357 class HeapInspection : public StackObj {
 358   bool _csv_format; // "comma separated values" format for spreadsheet.
 359   bool _print_help;
 360   bool _print_class_stats;
 361   const char* _columns;
 362  public:
 363   HeapInspection(bool csv_format, bool print_help,


 264   friend class KlassHierarchy;
 265 };
 266 
 267 class KlassHierarchy : AllStatic {
 268  public:
 269   static void print_class_hierarchy(outputStream* st, bool print_interfaces,  bool print_subclasses,
 270                                     char* classname);
 271 
 272  private:
 273   static void set_do_print_for_class_hierarchy(KlassInfoEntry* cie, KlassInfoTable* cit,
 274                                                bool print_subclasse);
 275   static void print_class(outputStream* st, KlassInfoEntry* cie, bool print_subclasses);
 276 };
 277 
 278 class KlassInfoHisto : public StackObj {
 279  private:
 280   static const int _histo_initial_size = 1000;
 281   KlassInfoTable *_cit;
 282   GrowableArray<KlassInfoEntry*>* _elements;
 283   GrowableArray<KlassInfoEntry*>* elements() const { return _elements; }


 284   static int sort_helper(KlassInfoEntry** e1, KlassInfoEntry** e2);
 285   void print_elements(outputStream* st) const;
 286   void print_class_stats(outputStream* st, bool csv_format, const char *columns);
 287   julong annotations_bytes(Array<AnnotationArray*>* p) const;
 288   const char *_selected_columns;
 289   bool is_selected(const char *col_name);
 290   void print_title(outputStream* st, bool csv_format,
 291                    bool selected_columns_table[], int width_table[],
 292                    const char *name_table[]);
 293 
 294   template <class T> static int count_bytes(T* x) {
 295     return (HeapWordSize * ((x) ? (x)->size() : 0));
 296   }
 297 
 298   template <class T> static int count_bytes_array(T* x) {
 299     if (x == NULL) {
 300       return 0;
 301     }
 302     if (x->length() == 0) {
 303       // This is a shared array, e.g., Universe::the_empty_int_array(). Don't


 321     }
 322     int w = 0;
 323     while (n > 0) {
 324       n /= 10;
 325       w += 1;
 326     }
 327     return w;
 328   }
 329 
 330   static int col_width(julong n, const char *name) {
 331     int w = julong_width(n);
 332     int min = (int)(strlen(name));
 333     if (w < min) {
 334         w = min;
 335     }
 336     // add a leading space for separation.
 337     return w + 1;
 338   }
 339 
 340  public:
 341   KlassInfoHisto(KlassInfoTable* cit);
 342   ~KlassInfoHisto();
 343   void add(KlassInfoEntry* cie);
 344   void print_histo_on(outputStream* st, bool print_class_stats, bool csv_format, const char *columns);
 345   void sort();
 346 };
 347 
 348 #endif // INCLUDE_SERVICES
 349 
 350 // These declarations are needed since the declaration of KlassInfoTable and
 351 // KlassInfoClosure are guarded by #if INLCUDE_SERVICES
 352 class KlassInfoTable;
 353 class KlassInfoClosure;
 354 
 355 class HeapInspection : public StackObj {
 356   bool _csv_format; // "comma separated values" format for spreadsheet.
 357   bool _print_help;
 358   bool _print_class_stats;
 359   const char* _columns;
 360  public:
 361   HeapInspection(bool csv_format, bool print_help,
< prev index next >