summaryrefslogtreecommitdiff
path: root/src/common/ht.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/ht.h')
-rw-r--r--src/common/ht.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/common/ht.h b/src/common/ht.h
index 033cd89ab0..0850c07092 100644
--- a/src/common/ht.h
+++ b/src/common/ht.h
@@ -42,6 +42,10 @@
#define HT_SIZE(head) \
((head)->hth_n_entries)
+/* Return memory usage for a hashtable (not counting the entries themselves) */
+#define HT_MEM_USAGE(head) \
+ (sizeof(*head) + (head)->hth_table_length * sizeof(void*))
+
#define HT_FIND(name, head, elm) name##_HT_FIND((head), (elm))
#define HT_INSERT(name, head, elm) name##_HT_INSERT((head), (elm))
#define HT_REPLACE(name, head, elm) name##_HT_REPLACE((head), (elm))