stats: more accurate time handling for wakeup thread

pull/3952/head
Victor Julien 7 years ago
parent ab1268cfea
commit 9474b84683

@ -439,7 +439,6 @@ static void *StatsMgmtThread(void *arg)
static void *StatsWakeupThread(void *arg) static void *StatsWakeupThread(void *arg)
{ {
ThreadVars *tv_local = (ThreadVars *)arg; ThreadVars *tv_local = (ThreadVars *)arg;
struct timespec cond_time;
/* Set the thread name */ /* Set the thread name */
if (SCSetThreadName(tv_local->name) < 0) { if (SCSetThreadName(tv_local->name) < 0) {
@ -468,8 +467,10 @@ static void *StatsWakeupThread(void *arg)
TmThreadsUnsetFlag(tv_local, THV_PAUSED); TmThreadsUnsetFlag(tv_local, THV_PAUSED);
} }
cond_time.tv_sec = time(NULL) + STATS_WUT_TTS; struct timeval cur_timev;
cond_time.tv_nsec = 0; gettimeofday(&cur_timev, NULL);
struct timespec cond_time = FROM_TIMEVAL(cur_timev);
cond_time.tv_sec += STATS_WUT_TTS;
/* wait for the set time, or until we are woken up by /* wait for the set time, or until we are woken up by
* the shutdown procedure */ * the shutdown procedure */

Loading…
Cancel
Save