diff --git a/src/counters.c b/src/counters.c index 2b2100a3649..0a6ace4bbb0 100644 --- a/src/counters.c +++ b/src/counters.c @@ -512,7 +512,6 @@ static void *StatsWakeupThread(void *arg) /* assuming the assignment of an int to be atomic, and even if it's * not, it should be okay */ tv->perf_public_ctx.perf_flag = 1; - tv->profile_flag = 1; if (tv->inq != NULL) { PacketQueue *q = tv->inq->pq; @@ -533,7 +532,6 @@ static void *StatsWakeupThread(void *arg) /* assuming the assignment of an int to be atomic, and even if it's * not, it should be okay */ tv->perf_public_ctx.perf_flag = 1; - tv->profile_flag = 1; tv = tv->next; } diff --git a/src/detect.c b/src/detect.c index 2648ad74b9a..8284a6597c2 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1792,6 +1792,15 @@ TmEcode Detect(ThreadVars *tv, Packet *p, void *data) } else { DetectNoFlow(tv, de_ctx, det_ctx, p); } + +#ifdef PROFILE_RULES + /* aggregate statistics */ + if (SCTIME_SECS(p->ts) != det_ctx->rule_perf_last_sync) { + SCProfilingRuleThreatAggregate(det_ctx); + det_ctx->rule_perf_last_sync = SCTIME_SECS(p->ts); + } +#endif + return TM_ECODE_OK; error: return TM_ECODE_FAILED; diff --git a/src/detect.h b/src/detect.h index 828428521e3..d66135b6c89 100644 --- a/src/detect.h +++ b/src/detect.h @@ -1188,6 +1188,7 @@ typedef struct DetectEngineThreadCtx_ { #ifdef PROFILE_RULES struct SCProfileData_ *rule_perf_data; int rule_perf_data_size; + uint32_t rule_perf_last_sync; #endif #ifdef PROFILING struct SCProfileKeywordData_ *keyword_perf_data; diff --git a/src/flow-worker.c b/src/flow-worker.c index 4a8bd9b506b..9ecfe65f299 100644 --- a/src/flow-worker.c +++ b/src/flow-worker.c @@ -614,14 +614,6 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data) /* process local work queue */ FlowWorkerProcessLocalFlows(tv, fw, p); -#ifdef PROFILE_RULES - /* aggregate statistics */ - if (tv->profile_flag == 1) { - SCProfilingRuleThreatAggregate((DetectEngineThreadCtx *)detect_thread); - tv->profile_flag = 0; - } -#endif - return TM_ECODE_OK; } diff --git a/src/threadvars.h b/src/threadvars.h index 6f16349fa28..ea448c09498 100644 --- a/src/threadvars.h +++ b/src/threadvars.h @@ -127,9 +127,6 @@ typedef struct ThreadVars_ { /** public counter store: counter syncs update this */ StatsPublicThreadContext perf_public_ctx; - /** profile sync needed */ - uint32_t profile_flag; - /* mutex and condition used by management threads */ SCCtrlMutex *ctrl_mutex;