Fix compiler warnings, cleanup counters config code.

remotes/origin/master-1.1.x
Victor Julien 14 years ago
parent ba18110abd
commit 355f237bfd

@ -115,7 +115,7 @@ static void CreateTimeString (const struct timeval *ts, char *str, size_t size)
struct tm *t = (struct tm *)localtime_r(&time, &local_tm);
snprintf(str, size, "%02d/%02d/%02d-%02d:%02d:%02d.%06u",
t->tm_mon + 1, t->tm_mday, 1, t->tm_year + 1900, t->tm_hour,
t->tm_mon + 1, t->tm_mday, t->tm_year + 1900, t->tm_hour,
t->tm_min, t->tm_sec, (uint32_t) ts->tv_usec);
}

@ -43,8 +43,10 @@
static SCPerfOPIfaceContext *sc_perf_op_ctx = NULL;
static time_t sc_start_time;
static uint32_t sc_counter_int = SC_PERF_MGMTT_TTS;
static const char *enabled = "yes";
/** refresh interval in seconds */
static uint32_t sc_counter_tts = SC_PERF_MGMTT_TTS;
/** is the stats counter enabled? */
static char sc_counter_enabled = TRUE;
/**
* \brief Adds a value of type uint64_t to the local counter.
@ -319,14 +321,15 @@ static void SCPerfInitOPCtx(void)
}
/* Check if the stats module is enabled or not */
if (stats != NULL) {
enabled = ConfNodeLookupChildValue(stats, "enabled");
if (strncmp(enabled, "no", 2) == 0) {
const char *enabled = ConfNodeLookupChildValue(stats, "enabled");
if (strcasecmp(enabled, "no") == 0) {
sc_counter_enabled = FALSE;
SCLogDebug("Stats module has been disabled");
SCReturn;
}
const char *interval = ConfNodeLookupChildValue(stats, "interval");
if (interval != NULL)
sc_counter_int = (uint32_t) atoi(interval);
sc_counter_tts = (uint32_t) atoi(interval);
}
/* Store the engine start time */
@ -443,7 +446,7 @@ static void *SCPerfMgmtThread(void *arg)
while (run) {
TmThreadTestThreadUnPaused(tv_local);
cond_time.tv_sec = time(NULL) + sc_counter_int;
cond_time.tv_sec = time(NULL) + sc_counter_tts;
cond_time.tv_nsec = 0;
SCMutexLock(tv_local->m);
@ -1148,8 +1151,10 @@ void SCPerfInitCounterApi(void)
*/
void SCPerfSpawnThreads(void)
{
if (strncmp(enabled, "no", 2) == 0) {
return;
SCEnter();
if (!sc_counter_enabled) {
SCReturn;
}
ThreadVars *tv_wakeup = NULL;
@ -1183,7 +1188,7 @@ void SCPerfSpawnThreads(void)
exit(EXIT_FAILURE);
}
return;
SCReturn;
}
/**

@ -83,8 +83,8 @@ outputs:
# on the log file.
- stats:
enabled: yes
filename: stats1.log
interval: 40
filename: stats.log
interval: 8
defrag:
max-frags: 65535

Loading…
Cancel
Save