278 |
278 |
279 // Running sum of space in all Metachunks that has been |
279 // Running sum of space in all Metachunks that has been |
280 // allocated to a Metaspace. This is used instead of |
280 // allocated to a Metaspace. This is used instead of |
281 // iterating over all the classloaders. One for each |
281 // iterating over all the classloaders. One for each |
282 // type of Metadata |
282 // type of Metadata |
283 static size_t _allocated_capacity_words[Metaspace:: MetadataTypeCount]; |
283 static size_t _capacity_words[Metaspace:: MetadataTypeCount]; |
284 // Running sum of space in all Metachunks that have |
284 // Running sum of space in all Metachunks that |
285 // are being used for metadata. One for each |
285 // are being used for metadata. One for each |
286 // type of Metadata. |
286 // type of Metadata. |
287 static size_t _allocated_used_words[Metaspace:: MetadataTypeCount]; |
287 static size_t _used_words[Metaspace:: MetadataTypeCount]; |
288 |
288 |
289 public: |
289 public: |
290 // Decrement and increment _allocated_capacity_words |
290 // Decrement and increment _allocated_capacity_words |
291 static void dec_capacity(Metaspace::MetadataType type, size_t words); |
291 static void dec_capacity(Metaspace::MetadataType type, size_t words); |
292 static void inc_capacity(Metaspace::MetadataType type, size_t words); |
292 static void inc_capacity(Metaspace::MetadataType type, size_t words); |
306 // Used by MetaspaceCounters |
306 // Used by MetaspaceCounters |
307 static size_t free_chunks_total_words(); |
307 static size_t free_chunks_total_words(); |
308 static size_t free_chunks_total_bytes(); |
308 static size_t free_chunks_total_bytes(); |
309 static size_t free_chunks_total_bytes(Metaspace::MetadataType mdtype); |
309 static size_t free_chunks_total_bytes(Metaspace::MetadataType mdtype); |
310 |
310 |
311 static size_t allocated_capacity_words(Metaspace::MetadataType mdtype) { |
311 static size_t capacity_words(Metaspace::MetadataType mdtype) { |
312 return _allocated_capacity_words[mdtype]; |
312 return _capacity_words[mdtype]; |
313 } |
313 } |
314 static size_t allocated_capacity_words() { |
314 static size_t capacity_words() { |
315 return allocated_capacity_words(Metaspace::NonClassType) + |
315 return capacity_words(Metaspace::NonClassType) + |
316 allocated_capacity_words(Metaspace::ClassType); |
316 capacity_words(Metaspace::ClassType); |
317 } |
317 } |
318 static size_t allocated_capacity_bytes(Metaspace::MetadataType mdtype) { |
318 static size_t capacity_bytes(Metaspace::MetadataType mdtype) { |
319 return allocated_capacity_words(mdtype) * BytesPerWord; |
319 return capacity_words(mdtype) * BytesPerWord; |
320 } |
320 } |
321 static size_t allocated_capacity_bytes() { |
321 static size_t capacity_bytes() { |
322 return allocated_capacity_words() * BytesPerWord; |
322 return capacity_words() * BytesPerWord; |
323 } |
323 } |
324 |
324 |
325 static size_t allocated_used_words(Metaspace::MetadataType mdtype) { |
325 static size_t used_words(Metaspace::MetadataType mdtype) { |
326 return _allocated_used_words[mdtype]; |
326 return _used_words[mdtype]; |
327 } |
327 } |
328 static size_t allocated_used_words() { |
328 static size_t used_words() { |
329 return allocated_used_words(Metaspace::NonClassType) + |
329 return used_words(Metaspace::NonClassType) + |
330 allocated_used_words(Metaspace::ClassType); |
330 used_words(Metaspace::ClassType); |
331 } |
331 } |
332 static size_t allocated_used_bytes(Metaspace::MetadataType mdtype) { |
332 static size_t used_bytes(Metaspace::MetadataType mdtype) { |
333 return allocated_used_words(mdtype) * BytesPerWord; |
333 return used_words(mdtype) * BytesPerWord; |
334 } |
334 } |
335 static size_t allocated_used_bytes() { |
335 static size_t used_bytes() { |
336 return allocated_used_words() * BytesPerWord; |
336 return used_words() * BytesPerWord; |
337 } |
337 } |
338 |
338 |
339 static size_t free_bytes(); |
339 static size_t free_bytes(); |
340 static size_t free_bytes(Metaspace::MetadataType mdtype); |
340 static size_t free_bytes(Metaspace::MetadataType mdtype); |
341 |
341 |