puint32 pcore_hash_size(phash_pool pool) { if (!pool) { plog_error("%s(): Нет phash_pool!", __PRETTY_FUNCTION__); return -1; } puint32 ret = 0; plog_dbg("%s(): Подсчёт количества элементов у пула 0x%08X", __PRETTY_FUNCTION__, pool); switch (pool->type) { case PHASH_FAST_SEARCH: ret = tommy_hashdyn_count((tommy_hashdyn *)pool->hash_struct); break; case PHASH_FAST_INSERT: default: ret = tommy_hashtable_count((tommy_hashtable *)pool->hash_struct); break; } return ret; }
tommy_size_t tommy_hashtable_memory_usage(tommy_hashtable* hashtable) { return hashtable->bucket_max * (tommy_size_t)sizeof(hashtable->bucket[0]) + tommy_hashtable_count(hashtable) * (tommy_size_t)sizeof(tommy_hashtable_node); }