62 }
63
64 CompactHashtableStats _symbol_stats;
65 CompactHashtableStats _string_stats;
66
67 int _counts[2][_number_of_types];
68 int _bytes [2][_number_of_types];
69
70 int _num_field_cp_entries;
71 int _num_field_cp_entries_archived;
72 int _num_field_cp_entries_reverted;
73 int _num_indy_cp_entries;
74 int _num_indy_cp_entries_archived;
75 int _num_indy_cp_entries_reverted;
76 int _num_klass_cp_entries;
77 int _num_klass_cp_entries_archived;
78 int _num_klass_cp_entries_reverted;
79 int _num_method_cp_entries;
80 int _num_method_cp_entries_archived;
81 int _num_method_cp_entries_reverted;
82
83 public:
84 enum { RO = 0, RW = 1 };
85
86 DumpAllocStats() {
87 memset(_counts, 0, sizeof(_counts));
88 memset(_bytes, 0, sizeof(_bytes));
89 _num_field_cp_entries = 0;
90 _num_field_cp_entries_archived = 0;
91 _num_field_cp_entries_reverted = 0;
92 _num_indy_cp_entries = 0;
93 _num_indy_cp_entries_archived = 0;
94 _num_indy_cp_entries_reverted = 0;
95 _num_klass_cp_entries = 0;
96 _num_klass_cp_entries_archived = 0;
97 _num_klass_cp_entries_reverted = 0;
98 _num_method_cp_entries = 0;
99 _num_method_cp_entries_archived = 0;
100 _num_method_cp_entries_reverted = 0;
101 };
102
103 CompactHashtableStats* symbol_stats() { return &_symbol_stats; }
104 CompactHashtableStats* string_stats() { return &_string_stats; }
105
106 void record(MetaspaceClosureType type, int byte_size, bool read_only) {
107 int t = (int)type;
108 assert(t >= 0 && t < (int)MetaspaceClosureType::_number_of_types, "sanity");
109 int which = (read_only) ? RO : RW;
110 _counts[which][t] ++;
111 _bytes [which][t] += byte_size;
112 }
113
114 void record_other_type(int byte_size, bool read_only) {
115 int which = (read_only) ? RO : RW;
116 _bytes [which][OtherType] += byte_size;
117 }
118
119 void record_cpp_vtables(int byte_size) {
120 _bytes[RW][CppVTablesType] += byte_size;
127 }
128
129 void record_indy_cp_entry(bool archived, bool reverted) {
130 _num_indy_cp_entries ++;
131 _num_indy_cp_entries_archived += archived ? 1 : 0;
132 _num_indy_cp_entries_reverted += reverted ? 1 : 0;
133 }
134
135 void record_klass_cp_entry(bool archived, bool reverted) {
136 _num_klass_cp_entries ++;
137 _num_klass_cp_entries_archived += archived ? 1 : 0;
138 _num_klass_cp_entries_reverted += reverted ? 1 : 0;
139 }
140
141 void record_method_cp_entry(bool archived, bool reverted) {
142 _num_method_cp_entries ++;
143 _num_method_cp_entries_archived += archived ? 1 : 0;
144 _num_method_cp_entries_reverted += reverted ? 1 : 0;
145 }
146
147 void print_stats(int ro_all, int rw_all);
148
149 DEBUG_ONLY(void verify(int expected_byte_size, bool read_only) const);
150
151 };
152
153 #endif // SHARE_CDS_DUMPALLOCSTATS_HPP
|
62 }
63
64 CompactHashtableStats _symbol_stats;
65 CompactHashtableStats _string_stats;
66
67 int _counts[2][_number_of_types];
68 int _bytes [2][_number_of_types];
69
70 int _num_field_cp_entries;
71 int _num_field_cp_entries_archived;
72 int _num_field_cp_entries_reverted;
73 int _num_indy_cp_entries;
74 int _num_indy_cp_entries_archived;
75 int _num_indy_cp_entries_reverted;
76 int _num_klass_cp_entries;
77 int _num_klass_cp_entries_archived;
78 int _num_klass_cp_entries_reverted;
79 int _num_method_cp_entries;
80 int _num_method_cp_entries_archived;
81 int _num_method_cp_entries_reverted;
82 int _num_dynamic_proxy_classes;
83
84 public:
85 enum { RO = 0, RW = 1 };
86
87 DumpAllocStats() {
88 memset(_counts, 0, sizeof(_counts));
89 memset(_bytes, 0, sizeof(_bytes));
90 _num_field_cp_entries = 0;
91 _num_field_cp_entries_archived = 0;
92 _num_field_cp_entries_reverted = 0;
93 _num_indy_cp_entries = 0;
94 _num_indy_cp_entries_archived = 0;
95 _num_indy_cp_entries_reverted = 0;
96 _num_klass_cp_entries = 0;
97 _num_klass_cp_entries_archived = 0;
98 _num_klass_cp_entries_reverted = 0;
99 _num_method_cp_entries = 0;
100 _num_method_cp_entries_archived = 0;
101 _num_method_cp_entries_reverted = 0;
102 _num_dynamic_proxy_classes = 0;
103 };
104
105 CompactHashtableStats* symbol_stats() { return &_symbol_stats; }
106 CompactHashtableStats* string_stats() { return &_string_stats; }
107
108 void record(MetaspaceClosureType type, int byte_size, bool read_only) {
109 int t = (int)type;
110 assert(t >= 0 && t < (int)MetaspaceClosureType::_number_of_types, "sanity");
111 int which = (read_only) ? RO : RW;
112 _counts[which][t] ++;
113 _bytes [which][t] += byte_size;
114 }
115
116 void record_other_type(int byte_size, bool read_only) {
117 int which = (read_only) ? RO : RW;
118 _bytes [which][OtherType] += byte_size;
119 }
120
121 void record_cpp_vtables(int byte_size) {
122 _bytes[RW][CppVTablesType] += byte_size;
129 }
130
131 void record_indy_cp_entry(bool archived, bool reverted) {
132 _num_indy_cp_entries ++;
133 _num_indy_cp_entries_archived += archived ? 1 : 0;
134 _num_indy_cp_entries_reverted += reverted ? 1 : 0;
135 }
136
137 void record_klass_cp_entry(bool archived, bool reverted) {
138 _num_klass_cp_entries ++;
139 _num_klass_cp_entries_archived += archived ? 1 : 0;
140 _num_klass_cp_entries_reverted += reverted ? 1 : 0;
141 }
142
143 void record_method_cp_entry(bool archived, bool reverted) {
144 _num_method_cp_entries ++;
145 _num_method_cp_entries_archived += archived ? 1 : 0;
146 _num_method_cp_entries_reverted += reverted ? 1 : 0;
147 }
148
149 void record_dynamic_proxy_class() {
150 _num_dynamic_proxy_classes ++;
151 }
152
153 void print_stats(int ro_all, int rw_all);
154
155 DEBUG_ONLY(void verify(int expected_byte_size, bool read_only) const);
156
157 };
158
159 #endif // SHARE_CDS_DUMPALLOCSTATS_HPP
|