From: Ian Jackson Date: Wed, 26 May 2010 17:33:38 +0000 (+0100) Subject: logstats control command X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=commitdiff_plain;h=448f81b035e0685c419b28262cacf7114106d8eb logstats control command --- diff --git a/cli.c b/cli.c index abb84a9..b03f370 100644 --- 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 }, diff --git a/innduct.8 b/innduct.8 index 23f93c9..1e233a7 100644 --- 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. diff --git a/innduct.h b/innduct.h index 78f06a8..6802fd8 100644 --- 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))) diff --git a/statemc.c b/statemc.c index b995957..c407b31 100644 --- 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)