counters: consolidate counters after all ThreadInit functions of a thread have run. This prevents duplicate and overwriting memory allocations.

pull/562/head
Victor Julien 13 years ago
parent 7f8d256e7c
commit 8080494e9a

@ -394,9 +394,6 @@ void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
SCPerfTVRegisterCounter("defrag.max_frag_hits", tv,
SC_PERF_TYPE_UINT64, "NULL");
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable(tv->name, &tv->sc_perf_pctx);
return;
}

@ -1225,9 +1225,6 @@ TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data)
/** alert counter setup */
det_ctx->counter_alerts = SCPerfTVRegisterCounter("detect.alert", tv,
SC_PERF_TYPE_UINT64, "NULL");
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ? tv->thread_group_name : tv->name,
&tv->sc_perf_pctx);
/* pass thread data back to caller */
*data = (void *)det_ctx;

@ -10482,6 +10482,10 @@ static int SigTestDetectAlertCounter(void)
tv.name = "detect_test";
DetectEngineThreadCtxInit(&tv, de_ctx, (void *)&det_ctx);
/* init counters */
tv.sc_perf_pca = SCPerfGetAllCountersArray(&tv.sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv.thread_group_name != NULL) ?
tv.thread_group_name : tv.name, &tv.sc_perf_pctx);
p = UTHBuildPacket((uint8_t *)"boo", strlen("boo"), IPPROTO_TCP);
Detect(&tv, p, det_ctx, NULL, NULL);

@ -428,8 +428,6 @@ static void MpipeRegisterPerfCounters(MpipeThreadVars *ptv, ThreadVars *tv)
ptv->counter_no_buffers_7 = SCPerfTVRegisterCounter("mpipe.no_buf7", tv,
SC_PERF_TYPE_UINT64,
"NULL");
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable(tv->name, &tv->sc_perf_pctx);
}
static const gxio_mpipe_buffer_size_enum_t gxio_buffer_sizes[] = {

@ -4526,9 +4526,6 @@ TmEcode StreamTcpThreadInit(ThreadVars *tv, void *initdata, void **data)
SC_PERF_TYPE_UINT64,
"NULL");
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable(tv->name, &tv->sc_perf_pctx);
SCLogDebug("StreamTcp thread specific ctx online at %p, reassembly ctx %p",
stt, stt->ra_ctx);

@ -157,6 +157,10 @@ void *TmThreadsSlot1NoIn(void *td)
memset(&s->slot_pre_pq, 0, sizeof(PacketQueue));
memset(&s->slot_post_pq, 0, sizeof(PacketQueue));
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->sc_perf_pctx);
TmThreadsSetFlag(tv, THV_INIT_DONE);
while (run) {
@ -263,6 +267,10 @@ void *TmThreadsSlot1NoOut(void *td)
memset(&s->slot_pre_pq, 0, sizeof(PacketQueue));
memset(&s->slot_post_pq, 0, sizeof(PacketQueue));
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->sc_perf_pctx);
TmThreadsSetFlag(tv, THV_INIT_DONE);
while (run) {
@ -352,6 +360,10 @@ void *TmThreadsSlot1NoInOut(void *td)
memset(&s->slot_pre_pq, 0, sizeof(PacketQueue));
memset(&s->slot_post_pq, 0, sizeof(PacketQueue));
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->sc_perf_pctx);
TmThreadsSetFlag(tv, THV_INIT_DONE);
while (run) {
@ -438,7 +450,12 @@ void *TmThreadsSlot1(void *td)
memset(&s->slot_post_pq, 0, sizeof(PacketQueue));
SCMutexInit(&s->slot_post_pq.mutex_q, NULL);
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->sc_perf_pctx);
TmThreadsSetFlag(tv, THV_INIT_DONE);
while (run) {
if (TmThreadsCheckFlag(tv, THV_PAUSE)) {
TmThreadsSetFlag(tv, THV_PAUSED);
@ -670,6 +687,10 @@ void *TmThreadsSlotPktAcqLoop(void *td) {
SCMutexInit(&slot->slot_post_pq.mutex_q, NULL);
}
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->sc_perf_pctx);
TmThreadsSetFlag(tv, THV_INIT_DONE);
while(run) {
@ -770,6 +791,10 @@ void *TmThreadsSlotVar(void *td)
SCMutexInit(&s->slot_post_pq.mutex_q, NULL);
}
tv->sc_perf_pca = SCPerfGetAllCountersArray(&tv->sc_perf_pctx);
SCPerfAddToClubbedTMTable((tv->thread_group_name != NULL) ?
tv->thread_group_name : tv->name, &tv->sc_perf_pctx);
TmThreadsSetFlag(tv, THV_INIT_DONE);
s = (TmSlot *)tv->tm_slots;

Loading…
Cancel
Save