Commit bfc48819 authored by vasil's avatar vasil

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
parent 2b93ccc9
......@@ -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);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment