diff options
author | Brian Paul <[email protected]> | 2012-01-11 12:58:43 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2012-01-11 12:58:45 -0700 |
commit | f1b33c74dc11b97a86a7f0e9cbe4cb168b2b9540 (patch) | |
tree | ab4624d6cc4d5446fc879b45ddc52bd00f06e546 /src/mesa/main/hash.c | |
parent | 6811704830b6637d7c9b19914bd3549143eeb3e5 (diff) |
mesa: add _mesa_HashNumEntries() function
Useful when debugging to find the number of texture objects, shader
programs, etc.
Diffstat (limited to 'src/mesa/main/hash.c')
-rw-r--r-- | src/mesa/main/hash.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 4b250ad5468..61c369a80cd 100644 --- a/src/mesa/main/hash.c +++ b/src/mesa/main/hash.c @@ -480,6 +480,26 @@ _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys) } +/** + * Return the number of entries in the hash table. + */ +GLuint +_mesa_HashNumEntries(const struct _mesa_HashTable *table) +{ + GLuint pos, count = 0; + + for (pos = 0; pos < TABLE_SIZE; pos++) { + const struct HashEntry *entry; + for (entry = table->Table[pos]; entry; entry = entry->Next) { + count++; + } + } + + return count; +} + + + #if 0 /* debug only */ /** |