summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am5
-rw-r--r--sizes.c29
3 files changed, 33 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index e600555..affe663 100644
--- a/.gitignore
+++ b/.gitignore
@@ -32,3 +32,4 @@ memcached_dtrace.h
memcached-*.tar.gz
doc/protocol-binary-range.txt
doc/protocol-binary.txt
+/sizes
diff --git a/Makefile.am b/Makefile.am
index 79e960d..ab4c26c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,4 +1,4 @@
-bin_PROGRAMS = memcached memcached-debug
+bin_PROGRAMS = memcached memcached-debug sizes
pkginclude_HEADERS = protocol_binary.h
BUILT_SOURCES=
@@ -58,7 +58,8 @@ EXTRA_DIST = doc scripts TODO t memcached.spec memcached_dtrace.d
MOSTLYCLEANFILES = *.gcov *.gcno *.gcda *.tcov
-test: memcached-debug
+test: memcached-debug sizes
+ $(srcdir)/sizes
prove $(srcdir)/t
@if test `basename $(PROFILER)` = "gcov"; then \
for file in memcached_debug-*.gc??; do \
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;
+}