This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx-apps.git
The following commit(s) were added to refs/heads/master by this push:
new 2bcc6b96e testing/sched: fix off-by-one sample count in timerjitter
2bcc6b96e is described below
commit 2bcc6b96ead84735e2d65876f46e80655377b769
Author: liang.huang <[email protected]>
AuthorDate: Sat Jul 11 12:06:14 2026 +0800
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 <[email protected]>
---
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)