diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-12-21 20:19:46 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2008-12-21 20:19:46 +0100 |
commit | c7243650c18ec4317a0897e9b406193854955201 (patch) | |
tree | 2f2c92c84354bd6df6097803870c532873a7a66d /src | |
parent | fa2e890e5216be401a73e346ca93c24144b764fc (diff) | |
download | conntrack-tools-c7243650c18ec4317a0897e9b406193854955201.tar.gz conntrack-tools-c7243650c18ec4317a0897e9b406193854955201.zip |
cache_iterators: display the commit time taken in the logs
This patch reports to the logfile the time taken to commit the
entries. The output is expressed in seconds.microseconds.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/cache_iterators.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/cache_iterators.c b/src/cache_iterators.c index 8ad9612..a14f428 100644 --- a/src/cache_iterators.c +++ b/src/cache_iterators.c @@ -195,6 +195,7 @@ void cache_commit(struct cache *c) unsigned int commit_exist = c->stats.commit_exist; unsigned int commit_fail = c->stats.commit_fail; struct __commit_container tmp; + struct timeval commit_start, commit_stop, res; tmp.h = nfct_open(CONNTRACK, 0); if (tmp.h == NULL) { @@ -203,9 +204,12 @@ void cache_commit(struct cache *c) } tmp.c = c; + gettimeofday(&commit_start, NULL); /* commit master conntrack first, then related ones */ hashtable_iterate(c->h, &tmp, do_commit_master); hashtable_iterate(c->h, &tmp, do_commit_related); + gettimeofday(&commit_stop, NULL); + timersub(&commit_stop, &commit_start, &res); /* calculate new entries committed */ commit_ok = c->stats.commit_ok - commit_ok; @@ -222,6 +226,9 @@ void cache_commit(struct cache *c) dlog(LOG_NOTICE, "%u entries can't be " "committed", commit_fail); nfct_close(tmp.h); + + dlog(LOG_NOTICE, "commit has taken %llu.%06llu seconds", + res.tv_sec, res.tv_usec); } static int do_reset_timers(void *data1, void *data2) |