summaryrefslogtreecommitdiffstats
path: root/tcps_sess.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-12 15:59:50 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-12 15:59:50 +0200
commitb5ccdf06724d309b777d4dd38a455ed2ef0318a0 (patch)
tree28375754743e82f03729bbda875fe0d043857e2e /tcps_sess.c
parentca0ddc30a3edce02a440904a01f0b866c0f82b5a (diff)
downloadrsyslog-b5ccdf06724d309b777d4dd38a455ed2ef0318a0.tar.gz
rsyslog-b5ccdf06724d309b777d4dd38a455ed2ef0318a0.tar.xz
rsyslog-b5ccdf06724d309b777d4dd38a455ed2ef0318a0.zip
performance-enhanced imtcp
...by now using lowres time and thus saving many time() calls. This needs some performance testing and must be made configurable if it works out.
Diffstat (limited to 'tcps_sess.c')
-rw-r--r--tcps_sess.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/tcps_sess.c b/tcps_sess.c
index d6bcd51b..8ba5cbec 100644
--- a/tcps_sess.c
+++ b/tcps_sess.c
@@ -56,6 +56,11 @@ DEFobjCurrIf(datetime)
static int iMaxLine; /* maximum size of a single message */
+#define TIME_REQUERY_DFLT 16 // TODO change back! 2
+static int iTimeRequery = TIME_REQUERY_DFLT;/* how often is time to be queried inside tight recv loop? 0=always */
+static int iNbrTimeUsed = 0; /* how often has previous time been used so far? */
+
+
/* forward definitions */
static rsRetVal Close(tcps_sess_t *pThis);
@@ -240,9 +245,10 @@ defaultDoSubmitMessage(tcps_sess_t *pThis)
FINALIZE;
}
- //TODO: if((iTimeRequery == 0) || (iNbrTimeUsed++ % iTimeRequery) == 0) {
+ if((iTimeRequery == 0) || (iNbrTimeUsed++ % iTimeRequery) == 0) {
+RUNLOG_STR("XXX: quering time!");
datetime.getCurrTime(&stTime, &ttGenTime);
- //}
+ }
/* we now create our own message object and submit it to the queue */
CHKiRet(msgConstructWithTime(&pMsg, &stTime, ttGenTime));
/* first trim the buffer to what we have actually received */
@@ -307,6 +313,7 @@ PrepareClose(tcps_sess_t *pThis)
* this case.
*/
dbgprintf("Extra data at end of stream in legacy syslog/tcp message - processing\n");
+ iNbrTimeUsed = 0; /* full time query */
defaultDoSubmitMessage(pThis);
}
@@ -451,6 +458,7 @@ DataRcvd(tcps_sess_t *pThis, char *pData, size_t iLen)
/* We now copy the message to the session buffer. */
pEnd = pData + iLen; /* this is one off, which is intensional */
+ iNbrTimeUsed = 0; /* full time query */
while(pData < pEnd) {
CHKiRet(processDataRcvd(pThis, *pData++));
}