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