Skip to content

Commit 3edc64f

Browse files
author
Corey Thomas
committed
Revert "profiling/rules: reduce sync logic scope"
This reverts commit b591813.
1 parent b6cd66f commit 3edc64f

File tree

5 files changed

+13
-10
lines changed

5 files changed

+13
-10
lines changed

src/counters.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -512,6 +512,7 @@ static void *StatsWakeupThread(void *arg)
512512
/* assuming the assignment of an int to be atomic, and even if it's
513513
* not, it should be okay */
514514
tv->perf_public_ctx.perf_flag = 1;
515+
tv->profile_flag = 1;
515516

516517
if (tv->inq != NULL) {
517518
PacketQueue *q = tv->inq->pq;
@@ -532,6 +533,7 @@ static void *StatsWakeupThread(void *arg)
532533
/* assuming the assignment of an int to be atomic, and even if it's
533534
* not, it should be okay */
534535
tv->perf_public_ctx.perf_flag = 1;
536+
tv->profile_flag = 1;
535537

536538
tv = tv->next;
537539
}

src/detect.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1794,15 +1794,6 @@ TmEcode Detect(ThreadVars *tv, Packet *p, void *data)
17941794
} else {
17951795
DetectNoFlow(tv, de_ctx, det_ctx, p);
17961796
}
1797-
1798-
#ifdef PROFILE_RULES
1799-
/* aggregate statistics */
1800-
if (SCTIME_SECS(p->ts) != det_ctx->rule_perf_last_sync) {
1801-
SCProfilingRuleThreatAggregate(det_ctx);
1802-
det_ctx->rule_perf_last_sync = SCTIME_SECS(p->ts);
1803-
}
1804-
#endif
1805-
18061797
return TM_ECODE_OK;
18071798
error:
18081799
return TM_ECODE_FAILED;

src/detect.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,6 @@ typedef struct DetectEngineThreadCtx_ {
12321232
#ifdef PROFILE_RULES
12331233
struct SCProfileData_ *rule_perf_data;
12341234
int rule_perf_data_size;
1235-
uint32_t rule_perf_last_sync;
12361235
#endif
12371236
#ifdef PROFILING
12381237
struct SCProfileKeywordData_ *keyword_perf_data;

src/flow-worker.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -685,6 +685,14 @@ static TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data)
685685
/* process local work queue */
686686
FlowWorkerProcessLocalFlows(tv, fw, p);
687687

688+
#ifdef PROFILE_RULES
689+
/* aggregate statistics */
690+
if (tv->profile_flag == 1) {
691+
SCProfilingRuleThreatAggregate((DetectEngineThreadCtx *)detect_thread);
692+
tv->profile_flag = 0;
693+
}
694+
#endif
695+
688696
return TM_ECODE_OK;
689697
}
690698

src/threadvars.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,9 @@ typedef struct ThreadVars_ {
127127
/** public counter store: counter syncs update this */
128128
StatsPublicThreadContext perf_public_ctx;
129129

130+
/** profile sync needed */
131+
uint32_t profile_flag;
132+
130133
/* mutex and condition used by management threads */
131134

132135
SCCtrlMutex *ctrl_mutex;

0 commit comments

Comments
 (0)