]> err.no Git - varnish/commitdiff
reimplement CLI stats
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 4 Aug 2006 09:06:07 +0000 (09:06 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Fri, 4 Aug 2006 09:06:07 +0000 (09:06 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@634 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/mgt_cli.c

index cc75a179b93a9b28642a9f3ebbe05c77d466f5c9..f87c2fa1659cc0262b1a6c26c8c500306ff063f7 100644 (file)
@@ -19,6 +19,7 @@
 #include "sbuf.h"
 #include "common_cli.h"
 #include "mgt.h"
+#include "shmlog.h"
 
 static int             cli_i = -1, cli_o = -1;
 static pthread_mutex_t cli_mtx;
@@ -37,6 +38,23 @@ mcf_server_startstop(struct cli *cli, char **av, void *priv)
                mgt_start_child();
 }
 
+/*--------------------------------------------------------------------*/
+
+static void
+mcf_stats(struct cli *cli, char **av, void *priv)
+{
+
+       (void)av;
+       (void)priv;
+
+       assert (VSL_stats != NULL);
+#define MAC_STAT(n,t,f,d) \
+    cli_out(cli, "%12ju  " d "\n", (VSL_stats->n));
+#include "stat_field.h"
+#undef MAC_STAT
+}
+
+
 /*--------------------------------------------------------------------
  * Passthru of cli commands.  It is more or less just undoing what
  * the cli parser did, but such is life...
@@ -103,6 +121,7 @@ static struct cli_proto mgt_cli_proto[] = {
        { CLI_PING,             cli_func_ping },
        { CLI_SERVER_START,     mcf_server_startstop, NULL },
        { CLI_SERVER_STOP,      mcf_server_startstop, &cli_proto },
+       { CLI_STATS,            mcf_stats, NULL },
        { CLI_CONFIG_LOAD },
 #if 0
        { CLI_CONFIG_LOAD,      m_cli_func_config_load, NULL },
@@ -110,7 +129,6 @@ static struct cli_proto mgt_cli_proto[] = {
        { CLI_SERVER_STOP,      m_cli_func_server_stop, NULL },
        { CLI_SERVER_RESTART },
        { CLI_PING,             m_cli_func_ping, NULL },
-       { CLI_STATS,            m_cli_func_stats, NULL },
        { CLI_ZERO },
        { CLI_VERBOSE,          m_cli_func_verbose, NULL },
        { CLI_EXIT,             m_cli_func_exit, NULL},