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:
vasil 2007-10-08 10:46:26 +00:00
parent 2b93ccc9c1
commit bfc48819c5
2 changed files with 29 additions and 0 deletions

View file

@ -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

View file

@ -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);
}