31
31
32
32
namespace metaspace {
33
33
34
+ // Calculates total number of committed words over all chunks (walks chunks).
35
+ size_t FreeChunkList::calc_committed_word_size () const {
36
+ size_t s = 0 ;
37
+ for (const Metachunk* c = _first; c != NULL ; c = c->next ()) {
38
+ s += c->committed_words ();
39
+ }
40
+ return s;
41
+ }
42
+
34
43
void FreeChunkList::print_on (outputStream* st) const {
35
44
if (_num_chunks.get () > 0 ) {
36
45
for (const Metachunk* c = _first; c != NULL ; c = c->next ()) {
@@ -60,7 +69,6 @@ void FreeChunkList::verify() const {
60
69
assert (_last == NULL , " Sanity" );
61
70
} else {
62
71
assert (_last != NULL , " Sanity" );
63
- size_t committed = 0 ;
64
72
int num = 0 ;
65
73
bool uncommitted = (_first->committed_words () == 0 );
66
74
for (Metachunk* c = _first; c != NULL ; c = c->next ()) {
@@ -71,11 +79,9 @@ void FreeChunkList::verify() const {
71
79
assert (c->prev () == NULL || c->prev ()->next () == c, " back link broken" );
72
80
assert (c != c->prev () && c != c->next (), " circle" );
73
81
c->verify ();
74
- committed += c->committed_words ();
75
82
num++;
76
83
}
77
84
_num_chunks.check (num);
78
- _committed_word_size.check (committed);
79
85
}
80
86
}
81
87
@@ -90,15 +96,19 @@ size_t FreeChunkListVector::word_size() const {
90
96
return sum;
91
97
}
92
98
93
- // Returns total committed size in all lists
94
- size_t FreeChunkListVector::committed_word_size () const {
99
+ // Calculates total number of committed words over all chunks (walks chunks).
100
+ size_t FreeChunkListVector::calc_committed_word_size () const {
95
101
size_t sum = 0 ;
96
102
for (chunklevel_t l = chunklevel::LOWEST_CHUNK_LEVEL; l <= chunklevel::HIGHEST_CHUNK_LEVEL; l++) {
97
- sum += list_for_level (l)-> committed_word_size ( );
103
+ sum += calc_committed_word_size_at_level (l );
98
104
}
99
105
return sum;
100
106
}
101
107
108
+ size_t FreeChunkListVector::calc_committed_word_size_at_level (chunklevel_t lvl) const {
109
+ return list_for_level (lvl)->calc_committed_word_size ();
110
+ }
111
+
102
112
// Returns total committed size in all lists
103
113
int FreeChunkListVector::num_chunks () const {
104
114
int n = 0 ;
@@ -146,8 +156,8 @@ void FreeChunkListVector::print_on(outputStream* st) const {
146
156
list_for_level (l)->print_on (st);
147
157
st->cr ();
148
158
}
149
- st->print_cr (" total chunks: %d, total word size: " SIZE_FORMAT " , committed word size: " SIZE_FORMAT " ." ,
150
- num_chunks (), word_size (), committed_word_size () );
159
+ st->print_cr (" total chunks: %d, total word size: " SIZE_FORMAT " ." ,
160
+ num_chunks (), word_size ());
151
161
}
152
162
153
163
#ifdef ASSERT
0 commit comments