r634 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Aug 4 11:06:08 CEST 2006


Author: phk
Date: 2006-08-04 11:06:07 +0200 (Fri, 04 Aug 2006)
New Revision: 634

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_cli.c
Log:
reimplement CLI stats


Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c	2006-08-04 07:21:50 UTC (rev 633)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c	2006-08-04 09:06:07 UTC (rev 634)
@@ -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 @@
 		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 @@
 	{ 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 @@
 	{ 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},




More information about the varnish-commit mailing list