From: Ian Jackson Date: Fri, 28 May 2010 19:56:30 +0000 (+0100) Subject: Log stats at intervals X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=innduct.git;a=commitdiff_plain;h=12629a26c20d3c5c00b4f71f5c73c304031a303b;hp=47015e24cbd42868bdfc7e93c5f53252d1d3925a Log stats at intervals --- diff --git a/duct.c b/duct.c index 489fb92..a7c4872 100644 --- a/duct.c +++ b/duct.c @@ -44,6 +44,7 @@ pid_t self_pid; int *lowvol_perperiod; int lowvol_circptr; int lowvol_total; /* does not include current period */ +int until_stats_log=1; /*---------- configuration option variables ----------*/ /* when changing defaults, remember to update the manpage */ @@ -77,6 +78,7 @@ int backlog_spontrescan_periods=300; int spontaneous_flush_periods=100000; int max_separated_periods=2000; int need_activity_periods=1000; +int stats_log_periods=2500; int lowvol_thresh=3; int lowvol_periods=1000; @@ -169,6 +171,9 @@ void period(void) { free(dipf_flushing); free(dipf_backlog); + if (until_stats_log) until_stats_log--; + else showstats(); + if (until_connect) until_connect--; inputfile_queue_check_expired(backlog_input_file); @@ -378,6 +383,7 @@ static const Option innduct_options[]= { {0,"max-flush-interval", "PERIOD", &spontaneous_flush_periods,op_seconds }, {0,"flush-finish-timeout", "PERIOD", &max_separated_periods, op_seconds }, {0,"idle-timeout", "PERIOD", &need_activity_periods, op_seconds }, +{0,"stats-log-interval", "PERIOD", &stats_log_periods, op_seconds }, {0,"low-volume-thresh", "PERIOD", &lowvol_thresh, op_integer }, {0,"low-volume-window", "PERIOD", &lowvol_periods, op_seconds }, diff --git a/innduct.8 b/innduct.8 index 1e233a7..e995464 100644 --- a/innduct.8 +++ b/innduct.8 @@ -183,8 +183,8 @@ 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. +logged periodically, 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 @@ -366,6 +366,12 @@ unresponsive or the connection has become broken. The default is .BR 1000s . .TP +.BI \-\-stats-log-interval= PERIOD +Log statistics at least every +.IR PERIOD +The default is +.BR 2500s . +.TP .BI \-\-low-volume-thresh= "WIN-THRESH " \-\-low-volume-window= "PERIOD " If innduct has only one connection to the peer, and has processed fewer than diff --git a/innduct.h b/innduct.h index 6802fd8..65077d6 100644 --- a/innduct.h +++ b/innduct.h @@ -176,6 +176,7 @@ extern int backlog_spontrescan_periods; extern int spontaneous_flush_periods; extern int max_separated_periods; extern int need_activity_periods; +extern int stats_log_periods; extern int lowvol_thresh; extern int lowvol_periods; @@ -473,7 +474,7 @@ extern pid_t inndcomm_child; /*========== general operational variables ==========*/ -/* innduct.c */ +/* duct.c */ extern oop_source *loop; extern ConnList conns; extern char *path_lock, *path_flushing, *path_defer, *path_dump; @@ -482,6 +483,7 @@ extern pid_t self_pid; extern int *lowvol_perperiod; extern int lowvol_circptr; extern int lowvol_total; /* does not include current period */ +extern int until_stats_log; /* statemc.c */ extern StateMachineState sms; diff --git a/statemc.c b/statemc.c index c407b31..5adecf9 100644 --- a/statemc.c +++ b/statemc.c @@ -490,6 +490,7 @@ void showstats(void) { if (backlog_input_file) notice_processed(backlog_input_file,0, "backlog file ", backlog_input_file->path); + until_stats_log= stats_log_periods; } static int signal_self_pipe[2];