profiling/rules: reduce sync logic scope

Use a simple once a second scheme.
pull/8879/head
Victor Julien 2 years ago
parent 694bff11ac
commit b591813b86

@ -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;
}

@ -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;

@ -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;

@ -614,14 +614,6 @@ housekeeping:
/* 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;
}

@ -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;

Loading…
Cancel
Save