mirror of
https://github.com/MariaDB/server.git
synced 2025-01-31 11:01:52 +01:00
branches/zip:
Add diagnostic function ha_storage_get_size() to retrieve the amount of memory used by a ha_storage_t object. Approved by: Marko
This commit is contained in:
parent
2b93ccc9c1
commit
bfc48819c5
2 changed files with 29 additions and 0 deletions
|
@ -77,6 +77,15 @@ ha_storage_free(
|
|||
/*============*/
|
||||
ha_storage_t* storage); /* in/out: hash storage */
|
||||
|
||||
/***********************************************************************
|
||||
Gets the size of the memory used by a storage. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
ha_storage_get_size(
|
||||
/*================*/
|
||||
/* out: bytes used */
|
||||
const ha_storage_t* storage); /* in: hash storage */
|
||||
|
||||
#ifndef UNIV_NONINL
|
||||
#include "ha0storage.ic"
|
||||
#endif
|
||||
|
|
|
@ -108,3 +108,23 @@ ha_storage_free(
|
|||
hash_table_free(storage->hash);
|
||||
mem_heap_free(storage->heap);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
Gets the size of the memory used by a storage. */
|
||||
UNIV_INLINE
|
||||
ulint
|
||||
ha_storage_get_size(
|
||||
/*================*/
|
||||
/* out: bytes used */
|
||||
const ha_storage_t* storage) /* in: hash storage */
|
||||
{
|
||||
ulint ret;
|
||||
|
||||
ret = mem_heap_get_size(storage->heap);
|
||||
|
||||
/* this assumes hash->heap and hash->heaps are NULL */
|
||||
ret += sizeof(hash_table_t);
|
||||
ret += sizeof(hash_cell_t) * hash_get_n_cells(storage->hash);
|
||||
|
||||
return(ret);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue