]> err.no Git - varnish/commitdiff
Move the sizeof debugging output to an undocumented debug.sizeof
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 15 Feb 2008 10:08:02 +0000 (10:08 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 15 Feb 2008 10:08:02 +0000 (10:08 +0000)
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
varnish-cache/bin/varnishd/cache_main.c

index 9f8d5b080a4d1fce4c3e96fd95233a279fd2322a..065f3fe45ba5e3e798ad215ac9b689ca1aaa477c 100644 (file)
@@ -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 }
 };
 
index d7c86289d5448bb3d70532075d614515ad69fee5..666ada39f7214605fe425ffc335289110e74c41e 100644 (file)
@@ -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();