chiark / gitweb /
logstats control command
authorIan Jackson <ian@liberator.(none)>
Wed, 26 May 2010 17:33:38 +0000 (18:33 +0100)
committerIan Jackson <ian@liberator.(none)>
Wed, 26 May 2010 17:33:38 +0000 (18:33 +0100)
cli.c
innduct.8
innduct.h
statemc.c

diff --git a/cli.c b/cli.c
index abb84a948aa0837d9c46063c377c48ac1d3a0802..b03f37065c799d175edfc627d95e0a85f92a5764 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -100,6 +100,8 @@ CCMD(stop) {
   abort();
 }
 
+CCMD(logstats) { showstats(); }
+
 CCMD(dump);
 
 /* messing with our head: */
@@ -112,6 +114,7 @@ static const CliCommand cli_commands[]= {
   { "h",             ccmd_help      },
   { "flush",         ccmd_flush     },
   { "stop",          ccmd_stop      },
+  { "logstats",      ccmd_logstats  },
   { "dump q",        ccmd_dump, 0,0 },
   { "dump a",        ccmd_dump, 0,1 },
 
index 23f93c90f34db5717202ea994f30722c6e91a0b9..1e233a78cf19b9f1202196b4d51fa788691896fe 100644 (file)
--- a/innduct.8
+++ b/innduct.8
@@ -181,6 +181,11 @@ to expire early, forcibly completing a previously started flush.)
 .B stop
 Log statistics and exit.  (Same effect as SIGTERM or SIGINT.)
 .TP
+.B logstats
+Log statistics so far and zero the stats counters.  Stats are also
+logged when an input file is completed and just before tidy
+termination.
+.TP
 .BR "dump q" | a
 Writes information about innduct's state to a plain text file
 .IR feedfile \fB_dump\fR.
index 78f06a8b762e5fc3ec51ea21f2d77f156b98ec3e..6802fd8ae9cbbdb56dcf0ff74041e05e031a89c0 100644 (file)
--- a/innduct.h
+++ b/innduct.h
@@ -433,6 +433,7 @@ void statemc_period_poll(void);
 void statemc_lock(void);
 void init_signals(void);
 void statemc_init(void);
+void showstats(void);
 
 #define SMS(newstate, periods, why) \
    (statemc_setstate(sm_##newstate,(periods),#newstate,(why)))
index b995957cdebdb4fd0529845fffea87d9dbe96c83..c407b31404fa79c4fe6285fe4728a96391dd1e3f 100644 (file)
--- a/statemc.c
+++ b/statemc.c
@@ -481,6 +481,10 @@ void spawn_inndcomm_flush(const char *why) { /* Moved => Flushing */
 
 void preterminate(void) {
   if (in_child) return;
+  showstats();
+}
+
+void showstats(void) {
   notice_processed(main_input_file,0,"feedfile","");
   notice_processed(flushing_input_file,0,"flushing","");
   if (backlog_input_file)