diff --git a/src/util-profiling.c b/src/util-profiling.c index 70b187e97a8f..11b853566278 100644 --- a/src/util-profiling.c +++ b/src/util-profiling.c @@ -1432,6 +1432,7 @@ void SCProfilingInit(void) SC_ATOMIC_INIT(profiling_rules_active); SC_ATOMIC_INIT(samples); intmax_t rate_v = 0; + ConfNode *conf; (void)ConfGetInt("profiling.sample-rate", &rate_v); if (rate_v > 0 && rate_v < INT_MAX) { @@ -1448,6 +1449,11 @@ void SCProfilingInit(void) else SCLogInfo("profiling runs for every packet"); } + + conf = ConfGetNode("profiling.rules"); + if (ConfNodeChildValueIsTrue(conf, "active")) { + SC_ATOMIC_SET(profiling_rules_active, 1); + } } /* see if we want to profile rules for this packet */ @@ -1466,7 +1472,6 @@ int SCProfileRuleStart(Packet *p) p->flags |= PKT_PROFILE; return 1; } - return 0; } diff --git a/suricata.yaml.in b/suricata.yaml.in index 1150f7ab9a97..897c71027a62 100644 --- a/suricata.yaml.in +++ b/suricata.yaml.in @@ -1810,6 +1810,10 @@ profiling: enabled: yes filename: rule_perf.log append: yes + # Set active to yes to enable rules profiling at start + # if set to no (default), the rules profiling will have to be started + # via unix socket commands. + #active:no # Sort options: ticks, avgticks, checks, matches, maxticks # If commented out all the sort options will be used.