Skip to content

Commit f2cd726

Browse files
committed
bpftune: tweak sampling to ensure at least one sample is collected
start sample count at 0 to ensure initial sample is taken; this prevents us missing events of interest that are infrequent. Signed-off-by: Alan Maguire <[email protected]>
1 parent d0bcb72 commit f2cd726

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/bpftune/bpftune.bpf.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ do { \
305305
\
306306
if (!sample.rate) \
307307
sample.rate = bpftune_sample_rate; \
308-
if (((++sample.count) % sample.rate) != 0) \
308+
if (((sample.count++) % sample.rate) != 0) \
309309
return 0; \
310310
last_ts = sample.ts; \
311311
sample.ts = bpf_ktime_get_ns(); \

0 commit comments

Comments
 (0)