From: Jeff Garzik jgar...@pobox.com
Subject: Re: Tabled issues
Date: Mon, 29 Mar 2010 15:32:33 -0400
I asserted that the standard stats dump facility must dump
all available statistics. That does not exclude other methods
of stat(us) dumping. Your patch added new stats to the HTML-pretty
version of output, but failed to add the new stats to the standard
stat dump facility.
Your wish is my command.
Signed-off-by: Pete Zaitcev zait...@redhat.com
---
server/replica.c | 28 +
server/server.c | 47 ++
server/status.c | 22 +--
server/storage.c | 50 +
server/tabled.h |3 ++
5 files changed, 117 insertions(+), 33 deletions(-)
commit 6bba495d750dcc7ebe63938b91d4bb22740879fe
Author: Pete Zaitcev zait...@yahoo.com
Date: Thu Apr 1 18:58:08 2010 -0600
Make signal+applog and HTTP displays uniform.
diff --git a/server/replica.c b/server/replica.c
index abdd647..e774824 100644
--- a/server/replica.c
+++ b/server/replica.c
@@ -871,6 +871,34 @@ void rep_start()
kscan_enabled = true;
}
+void rep_stats()
+{
+ bool running;
+ unsigned long kcnt;
+ time_t last;
+
+ applog(LOG_INFO, REP: Jobs: queued %d active %d done %d,
+ queue.njobs, active.njobs, done.njobs);
+
+ g_mutex_lock(kscan_mutex);
+ running = kscan_running;
+ last = kscan_last;
+ kcnt = kscan_cnt;
+ g_mutex_unlock(kscan_mutex);
+
+ if (running) {
+ applog(LOG_INFO, REP: run Active started %lu scanned %lu,
+ (long) last, kcnt);
+ } else {
+ if (last)
+ applog(LOG_INFO,
+ REP: run Done started %lu scanned %lu,
+ (long) last, kcnt);
+ else
+ applog(LOG_INFO, REP: run None);
+ }
+}
+
bool rep_status(struct client *cli, GList *content)
{
time_t now;
diff --git a/server/server.c b/server/server.c
index e0d785c..72db151 100644
--- a/server/server.c
+++ b/server/server.c
@@ -370,21 +370,50 @@ static void stats_signal(int signo)
write(tabled_srv.ev_pipe[1], cmd, 1);
}
-#define X(stat) \
- applog(LOG_INFO, STAT %s %lu, #stat, tabled_srv.stats.stat)
-
static void stats_dump(void)
{
- X(poll);
- X(event);
- X(tcp_accept);
- X(opt_write);
- applog(LOG_INFO, State: TDB %s,
+ applog(LOG_INFO, STATE: TDB %s,
state_name_tdb[tabled_srv.state_tdb]);
+ applog(LOG_INFO,
+ STATS: poll %lu event %lu tcp_accept %lu opt_write %lu,
+ tabled_srv.stats.poll,
+ tabled_srv.stats.event,
+ tabled_srv.stats.tcp_accept,
+ tabled_srv.stats.opt_write);
stor_stats();
+ rep_stats();
}
-#undef X
+bool stat_status(struct client *cli, GList *content)
+{
+ char *str;
+
+ /*
+* The loadavg is system dependent, we'll figure it out later.
+* On Linux, applications read from /proc/loadavg.
+*/
+ if (asprintf(str,
+h1Status/h1
+pHost %s port %s/p\r\n,
+tabled_srv.ourhost, tabled_srv.port) 0)
+ return false;
+ content = g_list_append(content, str);
+ if (asprintf(str,
+pState: TDB %s/p\r\n,
+state_name_tdb[tabled_srv.state_tdb]) 0)
+ return false;
+ content = g_list_append(content, str);
+ if (asprintf(str,
+pStats:
+poll %lu event %lu tcp_accept %lu opt_write %lu/p\r\n,
+tabled_srv.stats.poll,
+tabled_srv.stats.event,
+tabled_srv.stats.tcp_accept,
+tabled_srv.stats.opt_write) 0)
+ return false;
+ content = g_list_append(content, str);
+ return true;
+}
static bool cli_write_free(struct client *cli, struct client_write *tmp,
bool done)
diff --git a/server/status.c b/server/status.c
index bb67ac9..2029c09 100644
--- a/server/status.c
+++ b/server/status.c
@@ -114,25 +114,6 @@ out:
return false;
}
-static bool stat_status(struct client *cli, GList *content)
-{
- char *str;
-
- /*
-* The loadavg is system dependent, we'll figure it out later.
-* On Linux, applications read from /proc/loadavg.
-*/
- if (asprintf(str,
-h1Status/h1
-pHost %s port %s/p\r\n
-pStats: poll %lu event %lu/p\r\n,
-tabled_srv.ourhost, tabled_srv.port,
-tabled_srv.stats.poll, tabled_srv.stats.event) 0)
- return false;
- content = g_list_append(content, str);
- return true;
-}
-
static bool stat_root(struct client *cli)