summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-09-18 12:44:00 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-09-18 12:44:00 +0200
commit7b63cd6feda5087c43652bdcf8e694b544295d5b (patch)
treea51dd63c9b182a05848e35023f43d8807344113f /runtime
parentebc931db47bf1e28502a043dc2984acf5fd532b6 (diff)
downloadrsyslog-7b63cd6feda5087c43652bdcf8e694b544295d5b.tar.gz
rsyslog-7b63cd6feda5087c43652bdcf8e694b544295d5b.tar.xz
rsyslog-7b63cd6feda5087c43652bdcf8e694b544295d5b.zip
minor things, mostly improved debug info
Diffstat (limited to 'runtime')
-rw-r--r--runtime/debug.c6
-rw-r--r--runtime/msg.c4
-rw-r--r--runtime/srutils.c4
-rw-r--r--runtime/wtp.c2
4 files changed, 11 insertions, 5 deletions
diff --git a/runtime/debug.c b/runtime/debug.c
index 1450d029..958fb596 100644
--- a/runtime/debug.c
+++ b/runtime/debug.c
@@ -1,3 +1,4 @@
+#include <sys/syscall.h>
/* debug.c
*
* This file proides debug and run time error analysis support. Some of the
@@ -879,7 +880,7 @@ dbgprintf(char *fmt, ...)
}
/* do not cache the thread name, as the caller might have changed it
- * TODO: optimized, invalidate cache when new name is set
+ * TODO: optimize, invalidate cache when new name is set
*/
dbgGetThrdName(pszThrdName, sizeof(pszThrdName), ptLastThrdID, 0);
@@ -889,7 +890,8 @@ dbgprintf(char *fmt, ...)
if(stddbg != NULL) fprintf(stddbg, "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec);
if(altdbg != NULL) fprintf(altdbg, "%4.4ld.%9.9ld:", (long) (t.tv_sec % 10000), t.tv_nsec);
}
- if(stddbg != NULL) fprintf(stddbg, "%s: ", pszThrdName);
+ if(stddbg != NULL) fprintf(stddbg, "{%ld}%s: ", (long) syscall(SYS_gettid), pszThrdName);
+ /*if(stddbg != NULL) fprintf(stddbg, "%s: ", pszThrdName);*/
if(altdbg != NULL) fprintf(altdbg, "%s: ", pszThrdName);
}
bWasNL = (*(fmt + strlen(fmt) - 1) == '\n') ? 1 : 0;
diff --git a/runtime/msg.c b/runtime/msg.c
index f4eb9414..164c3517 100644
--- a/runtime/msg.c
+++ b/runtime/msg.c
@@ -140,8 +140,8 @@ void (*funcMsgPrepareEnqueue)(msg_t *pMsg);
#define MsgLock(pMsg) funcLock(pMsg)
#define MsgUnlock(pMsg) funcUnlock(pMsg)
#else
-#define MsgLock(pMsg) {dbgprintf("line %d\n - ", __LINE__); funcLock(pMsg);; }
-#define MsgUnlock(pMsg) {dbgprintf("line %d - ", __LINE__); funcUnlock(pMsg); }
+#define MsgLock(pMsg) {dbgprintf("MsgLock line %d\n - ", __LINE__); funcLock(pMsg);; }
+#define MsgUnlock(pMsg) {dbgprintf("MsgUnlock line %d - ", __LINE__); funcUnlock(pMsg); }
#endif
/* the next function is a dummy to be used by the looking functions
diff --git a/runtime/srutils.c b/runtime/srutils.c
index 97cc3252..1280e40d 100644
--- a/runtime/srutils.c
+++ b/runtime/srutils.c
@@ -371,6 +371,7 @@ int getNumberDigits(long lNum)
rsRetVal
timeoutComp(struct timespec *pt, long iTimeout)
{
+ BEGINfunc
assert(pt != NULL);
/* compute timeout */
clock_gettime(CLOCK_REALTIME, pt);
@@ -379,6 +380,7 @@ timeoutComp(struct timespec *pt, long iTimeout)
pt->tv_nsec -= 1000000000;
}
pt->tv_sec += iTimeout / 1000;
+ ENDfunc
return RS_RET_OK; /* so far, this is static... */
}
@@ -393,6 +395,7 @@ timeoutVal(struct timespec *pt)
{
struct timespec t;
long iTimeout;
+ BEGINfunc
assert(pt != NULL);
/* compute timeout */
@@ -403,6 +406,7 @@ timeoutVal(struct timespec *pt)
if(iTimeout < 0)
iTimeout = 0;
+ ENDfunc
return iTimeout;
}
diff --git a/runtime/wtp.c b/runtime/wtp.c
index 8b041ea2..ee9fc765 100644
--- a/runtime/wtp.c
+++ b/runtime/wtp.c
@@ -453,7 +453,7 @@ wtpStartWrkr(wtp_t *pThis, int bLockMutex)
ISOBJ_TYPE_assert(pThis, wtp);
- wtpProcessThrdChanges(pThis);
+ wtpProcessThrdChanges(pThis); // TODO: Performance: this causes a lot of FUTEX calls
BEGIN_MTX_PROTECTED_OPERATIONS(&pThis->mut, bLockMutex);