< prev index next >

src/hotspot/share/cds/dumpAllocStats.hpp

Print this page

 48     // Types are MetaspaceObj::ClassType, MetaspaceObj::SymbolType, etc
 49     SHAREDSPACE_OBJ_TYPES_DO(METASPACE_OBJ_TYPE_DECLARE)
 50     _number_of_types
 51   };
 52 
 53   static const char* type_name(Type type) {
 54     switch(type) {
 55     SHAREDSPACE_OBJ_TYPES_DO(METASPACE_OBJ_TYPE_NAME_CASE)
 56     default:
 57       ShouldNotReachHere();
 58       return nullptr;
 59     }
 60   }
 61 
 62   CompactHashtableStats _symbol_stats;
 63   CompactHashtableStats _string_stats;
 64 
 65   int _counts[2][_number_of_types];
 66   int _bytes [2][_number_of_types];
 67 




 68   int _num_klass_cp_entries;
 69   int _num_klass_cp_entries_archived;



 70 
 71 public:
 72   enum { RO = 0, RW = 1 };
 73 
 74   DumpAllocStats() {
 75     memset(_counts, 0, sizeof(_counts));
 76     memset(_bytes,  0, sizeof(_bytes));




 77     _num_klass_cp_entries = 0;
 78     _num_klass_cp_entries_archived = 0;



 79   };
 80 
 81   CompactHashtableStats* symbol_stats() { return &_symbol_stats; }
 82   CompactHashtableStats* string_stats() { return &_string_stats; }
 83 
 84   void record(MetaspaceObj::Type type, int byte_size, bool read_only) {
 85     assert(int(type) >= 0 && type < MetaspaceObj::_number_of_types, "sanity");
 86     int which = (read_only) ? RO : RW;
 87     _counts[which][type] ++;
 88     _bytes [which][type] += byte_size;
 89   }
 90 
 91   void record_modules(int byte_size, bool read_only) {
 92     int which = (read_only) ? RO : RW;
 93     _bytes [which][ModulesNativesType] += byte_size;
 94   }
 95 
 96   void record_other_type(int byte_size, bool read_only) {
 97     int which = (read_only) ? RO : RW;
 98     _bytes [which][OtherType] += byte_size;
 99   }
100 
101   void record_cpp_vtables(int byte_size) {
102     _bytes[RW][CppVTablesType] += byte_size;
103   }
104 










105   void record_klass_cp_entry(bool archived) {
106     _num_klass_cp_entries ++;
107     _num_klass_cp_entries_archived += archived ? 1 : 0;
108   }
109 









110   void print_stats(int ro_all, int rw_all);
111 };
112 
113 #endif // SHARE_CDS_DUMPALLOCSTATS_HPP

 48     // Types are MetaspaceObj::ClassType, MetaspaceObj::SymbolType, etc
 49     SHAREDSPACE_OBJ_TYPES_DO(METASPACE_OBJ_TYPE_DECLARE)
 50     _number_of_types
 51   };
 52 
 53   static const char* type_name(Type type) {
 54     switch(type) {
 55     SHAREDSPACE_OBJ_TYPES_DO(METASPACE_OBJ_TYPE_NAME_CASE)
 56     default:
 57       ShouldNotReachHere();
 58       return nullptr;
 59     }
 60   }
 61 
 62   CompactHashtableStats _symbol_stats;
 63   CompactHashtableStats _string_stats;
 64 
 65   int _counts[2][_number_of_types];
 66   int _bytes [2][_number_of_types];
 67 
 68   int _num_field_cp_entries;
 69   int _num_field_cp_entries_archived;
 70   int _num_indy_cp_entries;
 71   int _num_indy_cp_entries_archived;
 72   int _num_klass_cp_entries;
 73   int _num_klass_cp_entries_archived;
 74   int _num_method_cp_entries;
 75   int _num_method_cp_entries_archived;
 76   int _num_dynamic_proxy_classes;
 77 
 78 public:
 79   enum { RO = 0, RW = 1 };
 80 
 81   DumpAllocStats() {
 82     memset(_counts, 0, sizeof(_counts));
 83     memset(_bytes,  0, sizeof(_bytes));
 84     _num_field_cp_entries = 0;
 85     _num_field_cp_entries_archived = 0;
 86     _num_indy_cp_entries = 0;
 87     _num_indy_cp_entries_archived = 0;
 88     _num_klass_cp_entries = 0;
 89     _num_klass_cp_entries_archived = 0;
 90     _num_method_cp_entries = 0;
 91     _num_method_cp_entries_archived = 0;
 92     _num_dynamic_proxy_classes = 0;
 93   };
 94 
 95   CompactHashtableStats* symbol_stats() { return &_symbol_stats; }
 96   CompactHashtableStats* string_stats() { return &_string_stats; }
 97 
 98   void record(MetaspaceObj::Type type, int byte_size, bool read_only) {
 99     assert(int(type) >= 0 && type < MetaspaceObj::_number_of_types, "sanity");
100     int which = (read_only) ? RO : RW;
101     _counts[which][type] ++;
102     _bytes [which][type] += byte_size;
103   }
104 
105   void record_modules(int byte_size, bool read_only) {
106     int which = (read_only) ? RO : RW;
107     _bytes [which][ModulesNativesType] += byte_size;
108   }
109 
110   void record_other_type(int byte_size, bool read_only) {
111     int which = (read_only) ? RO : RW;
112     _bytes [which][OtherType] += byte_size;
113   }
114 
115   void record_cpp_vtables(int byte_size) {
116     _bytes[RW][CppVTablesType] += byte_size;
117   }
118 
119   void record_field_cp_entry(bool archived) {
120     _num_field_cp_entries ++;
121     _num_field_cp_entries_archived += archived ? 1 : 0;
122   }
123 
124   void record_indy_cp_entry(bool archived) {
125     _num_indy_cp_entries ++;
126     _num_indy_cp_entries_archived += archived ? 1 : 0;
127   }
128 
129   void record_klass_cp_entry(bool archived) {
130     _num_klass_cp_entries ++;
131     _num_klass_cp_entries_archived += archived ? 1 : 0;
132   }
133 
134   void record_method_cp_entry(bool archived) {
135     _num_method_cp_entries ++;
136     _num_method_cp_entries_archived += archived ? 1 : 0;
137   }
138 
139   void record_dynamic_proxy_class() {
140     _num_dynamic_proxy_classes ++;
141   }
142 
143   void print_stats(int ro_all, int rw_all);
144 };
145 
146 #endif // SHARE_CDS_DUMPALLOCSTATS_HPP
< prev index next >