--- djbdns-1.05/log.h 2005-03-16 13:00:04.779943592 -0700 +++ djbdns-1.05/log.h 2005-03-16 13:00:16.710129928 -0700 @@ -1,6 +1,8 @@ #ifndef LOG_H #define LOG_H +#define STATS_DISPLAY_INTERVAL 5 + #include "uint64.h" extern void log_startup(void); --- djbdns-1.05/log.c 2005-03-16 12:57:20.465923120 -0700 +++ djbdns-1.05/log.c 2005-03-16 13:01:36.092062040 -0700 @@ -4,6 +4,7 @@ #include "error.h" #include "byte.h" #include "log.h" +#include "time.h" /* work around gcc 2.95.2 bug */ #define number(x) ( (u64 = (x)), u64_print() ) @@ -274,11 +275,17 @@ void log_stats(void) { + static time_t prev = 0; + time_t cur = time(NULL); extern uint64 numqueries; extern uint64 cache_motion; extern int uactive; extern int tactive; + if(prev == 0) prev = time(NULL); + if(cur - prev < STATS_DISPLAY_INTERVAL) return; + prev = cur; + string("stats "); number(numqueries); space(); number(cache_motion); space();