diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-12 17:12:10 +0100 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-11-12 17:12:10 +0100 |
commit | 8b246de2a587454f9260ff91192d27a2e168ea2d (patch) | |
tree | eaf442ec207ba1f626119be4f983c69c9c2b5ba3 /runtime/queue.c | |
parent | 6b722a09d419ad2a552710260bb8e220858f17c2 (diff) | |
download | rsyslog-8b246de2a587454f9260ff91192d27a2e168ea2d.tar.gz rsyslog-8b246de2a587454f9260ff91192d27a2e168ea2d.tar.xz rsyslog-8b246de2a587454f9260ff91192d27a2e168ea2d.zip |
some light performance enhancement
...by replacing time() call with much faster (at least under linux)
gettimeofday() calls.
Diffstat (limited to 'runtime/queue.c')
-rw-r--r-- | runtime/queue.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/queue.c b/runtime/queue.c index 1c885925..b29ec7ac 100644 --- a/runtime/queue.c +++ b/runtime/queue.c @@ -56,6 +56,7 @@ #include "msg.h" #include "atomic.h" #include "errmsg.h" +#include "datetime.h" #include "unicode-helper.h" #include "msg.h" /* TODO: remove once we remove MsgAddRef() call */ @@ -68,6 +69,7 @@ DEFobjStaticHelpers DEFobjCurrIf(glbl) DEFobjCurrIf(strm) DEFobjCurrIf(errmsg) +DEFobjCurrIf(datetime) /* forward-definitions */ static inline rsRetVal doEnqSingleObj(qqueue_t *pThis, flowControl_t flowCtlType, void *pUsr); @@ -1526,7 +1528,7 @@ RateLimiter(qqueue_t *pThis) iDelay = 0; if(pThis->iDeqtWinToHr != 25) { /* 25 means disabled */ /* time calls are expensive, so only do them when needed */ - time(&tCurr); + datetime.GetTime(&tCurr); localtime_r(&tCurr, &m); iHrCurr = m.tm_hour; @@ -2327,6 +2329,7 @@ BEGINObjClassInit(qqueue, 1, OBJ_IS_CORE_MODULE) /* request objects we use */ CHKiRet(objUse(glbl, CORE_COMPONENT)); CHKiRet(objUse(strm, CORE_COMPONENT)); + CHKiRet(objUse(datetime, CORE_COMPONENT)); CHKiRet(objUse(errmsg, CORE_COMPONENT)); /* now set our own handlers */ |