Module: Mesa Branch: master Commit: f1b33c74dc11b97a86a7f0e9cbe4cb168b2b9540 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=f1b33c74dc11b97a86a7f0e9cbe4cb168b2b9540
Author: Brian Paul <bri...@vmware.com> Date: Wed Jan 11 12:58:43 2012 -0700 mesa: add _mesa_HashNumEntries() function Useful when debugging to find the number of texture objects, shader programs, etc. --- src/mesa/main/hash.c | 20 ++++++++++++++++++++ src/mesa/main/hash.h | 3 +++ 2 files changed, 23 insertions(+), 0 deletions(-) diff --git a/src/mesa/main/hash.c b/src/mesa/main/hash.c index 4b250ad..61c369a 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 */ /** diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h index 4f916f9..e935f8d 100644 --- a/src/mesa/main/hash.h +++ b/src/mesa/main/hash.h @@ -63,6 +63,9 @@ extern void _mesa_HashPrint(const struct _mesa_HashTable *table); extern GLuint _mesa_HashFindFreeKeyBlock(struct _mesa_HashTable *table, GLuint numKeys); +extern GLuint +_mesa_HashNumEntries(const struct _mesa_HashTable *table); + extern void _mesa_test_hash_functions(void); _______________________________________________ mesa-commit mailing list mesa-commit@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-commit