Use a simple once a second scheme.
/* 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;
/* 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;
}
} 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;
#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;
/* 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;
}
/** 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;