chiark / gitweb /
Log stats at intervals
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 28 May 2010 19:56:30 +0000 (20:56 +0100)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 28 May 2010 19:56:30 +0000 (20:56 +0100)
duct.c
innduct.8
innduct.h
statemc.c

diff --git a/duct.c b/duct.c
index 489fb92ee203c4c2fc740d83d7b52a1da50d4874..a7c487228fdae5a57500bf9266f75e372d0345d9 100644 (file)
--- 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 *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 */
 
 /*---------- 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 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;
 
 int lowvol_thresh=3;
 int lowvol_periods=1000;
 
@@ -169,6 +171,9 @@ void period(void) {
   free(dipf_flushing);
   free(dipf_backlog);
 
   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);
   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,"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 },
 
 {0,"low-volume-thresh",      "PERIOD", &lowvol_thresh,            op_integer },
 {0,"low-volume-window",      "PERIOD", &lowvol_periods,           op_seconds },
 
index 1e233a78cf19b9f1202196b4d51fa788691896fe..e995464f245f8c74eae53b92544fcab4b6e49704 100644 (file)
--- 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
 .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
 .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
 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
 .BI \-\-low-volume-thresh= "WIN-THRESH " \-\-low-volume-window= "PERIOD "
 If innduct has only one connection to the peer, and has processed
 fewer than
index 6802fd8ae9cbbdb56dcf0ff74041e05e031a89c0..65077d66b865a80f19d6fbe4a0e2be735ed3d4c6 100644 (file)
--- 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 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;
 
 extern int lowvol_thresh;
 extern int lowvol_periods;
 
@@ -473,7 +474,7 @@ extern pid_t inndcomm_child;
 
 /*========== general operational variables ==========*/
 
 
 /*========== general operational variables ==========*/
 
-/* innduct.c */
+/* duct.c */
 extern oop_source *loop;
 extern ConnList conns;
 extern char *path_lock, *path_flushing, *path_defer, *path_dump;
 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 *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;
 
 /* statemc.c */
 extern StateMachineState sms;
index c407b31404fa79c4fe6285fe4728a96391dd1e3f..5adecf95997cd79df2ea2dd3d4eb5746b7274547 100644 (file)
--- 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);
   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];
 }
 
 static int signal_self_pipe[2];