From: Eric Leblond Date: Wed, 17 Nov 2021 15:43:23 +0000 (+0100) Subject: profiling: fix profiling with sample rate X-Git-Tag: suricata-7.0.0-beta1~1211 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d5f59696dda77e1e7b2c45f51413b76690da4e9;p=thirdparty%2Fsuricata.git profiling: fix profiling with sample rate Rules profiling was returning invalid results when used with sample rate. The problem was that the sample condition was run twice in the packet flow. As a result, the second pass was not initializing the variable storing the initial CPU ticks and the resulting performance counters were reporting invalid values. Bug: #4836. --- diff --git a/src/util-profiling.c b/src/util-profiling.c index 3947f927f0..6034d20d1f 100644 --- a/src/util-profiling.c +++ b/src/util-profiling.c @@ -1243,6 +1243,8 @@ int SCProfileRuleStart(Packet *p) return 1; } #endif + if (p->flags & PKT_PROFILE) + return 1; return 0; }