From 58411110894c0a9e6a1a1ec9dbdf2fbe2ef3da00 Mon Sep 17 00:00:00 2001 From: Pablo Neira Ayuso Date: Fri, 21 Aug 2009 16:06:08 +0200 Subject: conntrackd: reduce the number of gettimeofday() syscalls This patch reduces the number of gettimeofday syscalls by caching the current time in a variable at the beginning of the main loop. Based on a suggestion from Vincent Jardin. Signed-off-by: Pablo Neira Ayuso --- src/run.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/run.c') diff --git a/src/run.c b/src/run.c index 8a15e14..54ab1a5 100644 --- a/src/run.c +++ b/src/run.c @@ -27,6 +27,7 @@ #include "traffic_stats.h" #include "process.h" #include "origin.h" +#include "date.h" #include #include @@ -545,6 +546,8 @@ run(void) struct timeval *next = NULL; while(1) { + do_gettimeofday(); + sigprocmask(SIG_BLOCK, &STATE(block), NULL); if (next != NULL && !timerisset(next)) next = do_alarm_run(&next_alarm); -- cgit v1.2.3