1 #include "config.h"
2 #include <stdio.h>
3 
4 #include "daemon/memcached.h"
5 
display(const char *name, size_t size)6 static void display(const char *name, size_t size) {
7     printf("%s\t%d\n", name, (int)size);
8 }
9 
calc_conn_size(void)10 static long calc_conn_size(void) {
11    long ret = sizeof(conn);
12    ret += DATA_BUFFER_SIZE; /* read */
13    ret += DATA_BUFFER_SIZE; /* write */
14    ret += (sizeof(item *) * ITEM_LIST_INITIAL);
15    ret += (sizeof(char *) * TEMP_ALLOC_LIST_INITIAL);
16    ret += (sizeof(struct iovec) * IOV_LIST_INITIAL);
17    ret += (sizeof(struct msghdr) * MSG_LIST_INITIAL);
18    return ret;
19 }
20 
21 
main(int argc, char **argv)22 int main(int argc, char **argv) {
23 
24 
25 
26     display("Slab Stats", sizeof(struct slab_stats));
27     display("Thread stats",
28             sizeof(struct thread_stats)
29             - (200 * sizeof(struct slab_stats)));
30     display("Global stats", sizeof(struct stats));
31     display("Settings", sizeof(struct settings));
32     display("Libevent thread",
33             sizeof(LIBEVENT_THREAD));
34     display("Connection", calc_conn_size());
35 
36     printf("----------------------------------------\n");
37 
38     display("libevent thread cumulative", sizeof(LIBEVENT_THREAD));
39     display("Thread stats cumulative\t", sizeof(struct thread_stats));
40 
41     return 0;
42 }
43