From 83c4c296f3692d3e4886d4177622cb3a1906e0de Mon Sep 17 00:00:00 2001 From: phk Date: Fri, 15 Feb 2008 10:08:02 +0000 Subject: [PATCH] Move the sizeof debugging output to an undocumented debug.sizeof CLI command. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2469 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/cache_cli.c | 28 +++++++++++++++++++++++++ varnish-cache/bin/varnishd/cache_main.c | 15 ------------- 2 files changed, 28 insertions(+), 15 deletions(-) diff --git a/varnish-cache/bin/varnishd/cache_cli.c b/varnish-cache/bin/varnishd/cache_cli.c index 9f8d5b08..065f3fe4 100644 --- a/varnish-cache/bin/varnishd/cache_cli.c +++ b/varnish-cache/bin/varnishd/cache_cli.c @@ -50,6 +50,30 @@ pthread_t cli_thread; /*--------------------------------------------------------------------*/ +static void +cli_debug_sizeof(struct cli *cli, const char * const *av, void *priv) +{ + (void)av; + (void)priv; + +#define SZOF(foo) cli_out(cli, \ + "sizeof(%s) = %zd = 0x%zx\n", #foo, sizeof(foo), sizeof(foo)); + SZOF(struct ws); + SZOF(struct http); + SZOF(struct http_conn); + SZOF(struct acct); + SZOF(struct worker); + SZOF(struct workreq); + SZOF(struct bereq); + SZOF(struct storage); + SZOF(struct object); + SZOF(struct objhead); + SZOF(struct sess); + SZOF(struct vbe_conn); +} + +/*--------------------------------------------------------------------*/ + static void cli_func_start(struct cli *cli, const char * const *av, void *priv) { @@ -77,6 +101,10 @@ struct cli_proto CLI_cmds[] = { { CLI_VCL_DISCARD, cli_func_config_discard }, { CLI_VCL_USE, cli_func_config_use }, + /* Undocumented functions for debugging */ + { "debug.sizeof", "debug.sizeof", + "\tDump sizeof various data structures\n", + 0, 0, cli_debug_sizeof }, { NULL } }; diff --git a/varnish-cache/bin/varnishd/cache_main.c b/varnish-cache/bin/varnishd/cache_main.c index d7c86289..666ada39 100644 --- a/varnish-cache/bin/varnishd/cache_main.c +++ b/varnish-cache/bin/varnishd/cache_main.c @@ -72,21 +72,6 @@ child_main(void) THR_Name("cache-main"); -#define SZOF(foo) printf("sizeof(%s) = %zd\n", #foo, sizeof(foo)); - SZOF(struct ws); - SZOF(struct http); - SZOF(struct http_conn); - SZOF(struct acct); - SZOF(struct worker); - SZOF(struct workreq); - SZOF(struct bereq); - SZOF(struct storage); - SZOF(struct object); - SZOF(struct objhead); - SZOF(struct sess); - SZOF(struct vbe_conn); - - CNT_Init(); VCL_Init(); -- 2.39.5