Mailing List Archive

r2469 - trunk/varnish-cache/bin/varnishd
Author: phk
Date: 2008-02-15 11:08:02 +0100 (Fri, 15 Feb 2008)
New Revision: 2469

Modified:
trunk/varnish-cache/bin/varnishd/cache_cli.c
trunk/varnish-cache/bin/varnishd/cache_main.c
Log:
Move the sizeof debugging output to an undocumented debug.sizeof
CLI command.


Modified: trunk/varnish-cache/bin/varnishd/cache_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 10:02:45 UTC (rev 2468)
+++ trunk/varnish-cache/bin/varnishd/cache_cli.c 2008-02-15 10:08:02 UTC (rev 2469)
@@ -51,6 +51,30 @@
/*--------------------------------------------------------------------*/

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 @@
{ 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 }
};


Modified: trunk/varnish-cache/bin/varnishd/cache_main.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-15 10:02:45 UTC (rev 2468)
+++ trunk/varnish-cache/bin/varnishd/cache_main.c 2008-02-15 10:08:02 UTC (rev 2469)
@@ -72,21 +72,6 @@

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();