summaryrefslogtreecommitdiff
path: root/sizes.c
diff options
context:
space:
mode:
authorDustin Sallings <dustin@spy.net>2009-03-10 08:35:34 -0700
committerDustin Sallings <dustin@spy.net>2009-03-10 12:59:07 -0700
commit44ec7ca57dd9241e178d65001105b7d100a7dd50 (patch)
treea5af9a50aae378db9344977265c1efd145df86aa /sizes.c
parenta45621053bc744a1cfc4b2c3732e26b8046a9044 (diff)
downloadmemcached-44ec7ca57dd9241e178d65001105b7d100a7dd50.tar.gz
Created a tool to show us the sizes of various data structures.
Diffstat (limited to 'sizes.c')
-rw-r--r--sizes.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/sizes.c b/sizes.c
new file mode 100644
index 0000000..95a644c
--- /dev/null
+++ b/sizes.c
@@ -0,0 +1,29 @@
+#include <stdio.h>
+
+#include "memcached.h"
+
+static void display(const char *name, size_t size) {
+ printf("%s\t%d\n", name, (int)size);
+}
+
+int main(int argc, char **argv) {
+
+ display("Slab Stats", sizeof(struct slab_stats));
+ display("Thread stats",
+ sizeof(struct thread_stats)
+ - (200 * sizeof(struct slab_stats)));
+ display("Global stats", sizeof(struct stats));
+ display("Settings", sizeof(struct settings));
+ display("Item (no cas)", sizeof(item));
+ display("Item (cas)", sizeof(item) + sizeof(uint64_t));
+ display("Libevent thread",
+ sizeof(LIBEVENT_THREAD) - sizeof(struct thread_stats));
+ display("Connection", sizeof(conn));
+
+ printf("----------------------------------------\n");
+
+ display("libevent thread cumulative", sizeof(LIBEVENT_THREAD));
+ display("Thread stats cumulative\t", sizeof(struct thread_stats));
+
+ return 0;
+}