counters: introduce SCPerfSetupPrivate for thread setup

pull/1508/head
Victor Julien 11 years ago
parent 799640f906
commit 74ab84c194

@ -191,6 +191,16 @@ void SCPerfCounterAddUI64(struct ThreadVars_ *, uint16_t, uint64_t);
} \
} while (0)
#define SCPerfSetupPrivate(tv) \
do { \
SCPerfGetAllCountersArray(&(tv)->perf_public_ctx, \
&(tv)->perf_private_ctx); \
\
SCPerfAddToClubbedTMTable(((tv)->thread_group_name != NULL) ? \
(tv)->thread_group_name : (tv)->name, \
&(tv)->perf_public_ctx); \
} while (0)
#ifdef BUILD_UNIX_SOCKET
#include <jansson.h>
TmEcode SCPerfOutputCounterSocket(json_t *cmd,

@ -11263,9 +11263,7 @@ static int SigTestDetectAlertCounter(void)
DetectEngineThreadCtxInit(&tv, de_ctx, (void *)&det_ctx);
/* init counters */
SCPerfGetAllCountersArray(&tv.perf_public_ctx, &tv.perf_private_ctx);
SCPerfAddToClubbedTMTable((tv.thread_group_name != NULL) ?
tv.thread_group_name : tv.name, &tv.perf_public_ctx);
SCPerfSetupPrivate(&tv);
p = UTHBuildPacket((uint8_t *)"boo", strlen("boo"), IPPROTO_TCP);
Detect(&tv, p, det_ctx, NULL, NULL);

@ -322,9 +322,7 @@ void *TmThreadsSlotPktAcqLoop(void *td)
}
}
SCPerfGetAllCountersArray(&tv->perf_public_ctx, &tv->perf_private_ctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->perf_public_ctx);
SCPerfSetupPrivate(tv);
TmThreadsSetFlag(tv, THV_INIT_DONE);
@ -455,9 +453,7 @@ void *TmThreadsSlotVar(void *td)
}
}
SCPerfGetAllCountersArray(&tv->perf_public_ctx, &tv->perf_private_ctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->perf_public_ctx);
SCPerfSetupPrivate(tv);
TmThreadsSetFlag(tv, THV_INIT_DONE);
@ -597,9 +593,7 @@ static void *TmThreadsManagement(void *td)
memset(&s->slot_pre_pq, 0, sizeof(PacketQueue));
memset(&s->slot_post_pq, 0, sizeof(PacketQueue));
SCPerfGetAllCountersArray(&tv->perf_public_ctx, &tv->perf_private_ctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->perf_public_ctx);
SCPerfSetupPrivate(tv);
TmThreadsSetFlag(tv, THV_INIT_DONE);

@ -868,8 +868,7 @@ static TmEcode UnixManager(ThreadVars *th_v, void *thread_data)
/* set the thread name */
SCLogDebug("%s started...", th_v->name);
SCPerfGetAllCountersArray(&th_v->perf_public_ctx, &th_v->perf_private_ctx);
SCPerfAddToClubbedTMTable(th_v->name, &th_v->perf_public_ctx);
SCPerfSetupPrivate(th_v);
if (UnixNew(&command) == 0) {
int failure_fatal = 0;

Loading…
Cancel
Save