From 2bcc6b96ead84735e2d65876f46e80655377b769 Mon Sep 17 00:00:00 2001 From: "liang.huang" Date: Sat, 11 Jul 2026 12:06:14 +0800 Subject: [PATCH] testing/sched: fix off-by-one sample count in timerjitter cur_cnt++ in the loop condition increments even when the loop body doesn't run, so avg is divided by one more sample than was collected. Signed-off-by: liang.huang --- testing/sched/timerjitter/timerjitter.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/sched/timerjitter/timerjitter.c b/testing/sched/timerjitter/timerjitter.c index 6811a3f19..2f7cea37f 100644 --- a/testing/sched/timerjitter/timerjitter.c +++ b/testing/sched/timerjitter/timerjitter.c @@ -195,8 +195,10 @@ static FAR void *timerjitter(FAR void *arg) param->max = 0; param->min = (unsigned long)-1; - while (param->cur_cnt++ < param->max_cnt) + while (param->cur_cnt < param->max_cnt) { + param->cur_cnt++; + /* Wait for SIGALRM */ if (sigwait(&sigset, &sigs) < 0)