summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-28 11:54:34 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-28 11:54:34 +0000
commitb44a5205f7f2f072e0154ebbfede6937a4d82abf (patch)
treefb8ea5e2162de024ca56057e5f8110e97196399f
parent94bfc28855393a1a688aa5fdc3339b9e2139e10a (diff)
downloadrsyslog-b44a5205f7f2f072e0154ebbfede6937a4d82abf.tar.gz
rsyslog-b44a5205f7f2f072e0154ebbfede6937a4d82abf.tar.xz
rsyslog-b44a5205f7f2f072e0154ebbfede6937a4d82abf.zip
- added "runtime instrumentation" feature to ./configure
- some more cleanup
-rw-r--r--configure.ac15
-rw-r--r--debug.h8
-rw-r--r--queue.c4
-rw-r--r--syslogd.c16
4 files changed, 30 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac
index ff043c86..63787560 100644
--- a/configure.ac
+++ b/configure.ac
@@ -270,6 +270,20 @@ if test "$enable_debug" = "no"; then
AC_DEFINE(NDEBUG, 1, [Defined if debug mode is disabled.])
fi
+# runtime instrumentation
+AC_ARG_ENABLE(rtinst,
+ [AS_HELP_STRING([--enable-rtinst],[Enable runtime instrumentation mode @<:@default=no@:>@])],
+ [case "${enableval}" in
+ yes) enable_rtinst="yes" ;;
+ no) enable_rtinst="no" ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-rtinst) ;;
+ esac],
+ [enable_rtinst="no"]
+)
+if test "$enable_rtinst" = "yes"; then
+ AC_DEFINE(RTINST, 1, [Defined if runtime instrumentation mode is enabled.])
+fi
+
# mudflap
AC_ARG_ENABLE(mudflap,
[AS_HELP_STRING([--enable-mudflap],[Enable mudflap @<:@default=no@:>@])],
@@ -429,5 +443,6 @@ echo "Large file support enabled: $enable_largefile"
echo "Networking support enabled: $enable_inet"
echo "Enable GSSAPI Kerberos 5 support: $want_gssapi_krb5"
echo "Debug mode enabled: $enable_debug"
+echo "Runtime Instrumentation enabled: $enable_rtinst"
echo "Mudflap enabled: $enable_mudflap"
diff --git a/debug.h b/debug.h
index 565fa04d..a9891d84 100644
--- a/debug.h
+++ b/debug.h
@@ -96,20 +96,20 @@ void dbgSetThrdName(uchar *pszName);
void dbgPrintAllDebugInfo(void);
/* macros */
-#if 1 /* DEV debug: set to 1 to get a rough call trace -- rgerhards, 2008-01-13 */
+#ifdef RTINST
# define BEGINfunc static dbgFuncDB_t dbgFuncDB=dbgFuncDB_t_INITIALIZER; int dbgCALLStaCK_POP_POINT = dbgEntrFunc(&dbgFuncDB,__LINE__);
# define ENDfunc dbgExitFunc(&dbgFuncDB, dbgCALLStaCK_POP_POINT);
#else
# define BEGINfunc
# define ENDfunc
#endif
-#if 1 /* DEV debug: set to 1 to enable -- rgerhards, 2008-01-13 */
+#ifdef RTINST
# define RUNLOG dbgSetExecLocation(dbgCALLStaCK_POP_POINT, __LINE__); dbgprintf("%s:%d: %s: log point\n", __FILE__, __LINE__, __func__)
# define RUNLOG_VAR(fmt, x) dbgSetExecLocation(dbgCALLStaCK_POP_POINT, __LINE__);\
dbgprintf("%s:%d: %s: var '%s'[%s]: " fmt "\n", __FILE__, __LINE__, __func__, #x, fmt, x)
#else
# define RUNLOG
-# define RUNLOG_VAR(x)
+# define RUNLOG_VAR(fmt, x)
#endif
/* mutex operations */
@@ -119,7 +119,7 @@ void dbgPrintAllDebugInfo(void);
/* debug aides */
-#if 1
+#ifdef RTINST
#define d_pthread_mutex_lock(x) dbgMutexLock(x, &dbgFuncDB, __LINE__, dbgCALLStaCK_POP_POINT )
#define d_pthread_mutex_unlock(x) dbgMutexUnlock(x, &dbgFuncDB, __LINE__, dbgCALLStaCK_POP_POINT )
#define d_pthread_cond_wait(cond, mut) dbgCondWait(cond, mut, &dbgFuncDB, __LINE__, dbgCALLStaCK_POP_POINT )
diff --git a/queue.c b/queue.c
index fa682765..a89c7de9 100644
--- a/queue.c
+++ b/queue.c
@@ -1321,10 +1321,6 @@ queueChkStopWrkrDA(queue_t *pThis)
static int
queueChkStopWrkrReg(queue_t *pThis)
{
- BEGINfunc
- int bStopWrkr = pThis->bEnqOnly || pThis->bRunsDA || (pThis->pqParent != NULL && pThis->iQueueSize == 0);
-RUNLOG_VAR("%d", bStopWrkr);
- ENDfunc
return pThis->bEnqOnly || pThis->bRunsDA || (pThis->pqParent != NULL && pThis->iQueueSize == 0);
}
diff --git a/syslogd.c b/syslogd.c
index dfc41b5d..c46b5507 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2659,7 +2659,7 @@ die(int sig)
/* de-init some modules */
modExitIminternal();
- dbgPrintAllDebugInfo(); /* this is the last spot where this can be done - below output modules are unloaded! */
+ /*dbgPrintAllDebugInfo(); / * this is the last spot where this can be done - below output modules are unloaded! */
/* TODO: this would also be the right place to de-init the builtin output modules. We
* do not currently do that, because the module interface does not allow for
@@ -2682,10 +2682,11 @@ die(int sig)
if(pModDir != NULL)
free(pModDir);
- /* exit classes... */
+ dbgprintf("Clean shutdown completed, bye\n");
+
+ /* exit classes... This MUST be after the dbgprintf (because it de-inits the debug system!) */
dbgClassExit();
- dbgprintf("Clean shutdown completed, bye.\n");
exit(0); /* "good" exit, this is the terminator function for rsyslog [die()] */
}
@@ -4632,15 +4633,20 @@ static void printVersion(void)
printf("\tFEATURE_NETZIP (message compression):\tNo\n");
#endif
#if defined(SYSLOG_INET) && defined(USE_GSSAPI)
- printf("\tFEATURE_GSSAPI (GSSAPI Kerberos 5 support):\tYes\n");
+ printf("\tGSSAPI Kerberos 5 support:\t\tYes\n");
#else
- printf("\tFEATURE_GSSAPI (GSSAPI Kerberos 5 support):\tNo\n");
+ printf("\tGSSAPI Kerberos 5 support:\t\tNo\n");
#endif
#ifndef NDEBUG
printf("\tFEATURE_DEBUG (debug build, slow code):\tYes\n");
#else
printf("\tFEATURE_DEBUG (debug build, slow code):\tNo\n");
#endif
+#ifdef RTINST
+ printf("\tRuntime Instrumentation (slow code):\tYes\n");
+#else
+ printf("\tRuntime Instrumentation (slow code):\tNo\n");
+#endif
printf("\nSee http://www.rsyslog.com for more information.\n");
}