[PATCH 14/34] cyclictest: fix MODE_CYCLIC measurement failure after timer overruns

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch aims to fix nonsensical results sometimes reported by
cyclictest when running in MODE_CYCLIC.

In MODE_CYCLIC if we hit the "now > next" case, we can end up adjusting
the "next" timespec twice: by the tsgreater-while-loop, and after that
on a later iteration of the loop by the result of timer_getoverrun().

After this double adjustment, the results will not be correct.

Signed-off-by: Tommi Rantala <tommi.t.rantala@xxxxxxxxx>
---
 src/cyclictest/cyclictest.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 7720fce..517f061 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -1230,15 +1230,15 @@ static void *timerthread(void *param)
 			}
 			next.tv_sec += overrun_count * interval.tv_sec;
 			next.tv_nsec += overrun_count * interval.tv_nsec;
+		} else {
+			while (tsgreater(&now, &next)) {
+				next.tv_sec += interval.tv_sec;
+				next.tv_nsec += interval.tv_nsec;
+				tsnorm(&next);
+			}
 		}
 		tsnorm(&next);
 
-		while (tsgreater(&now, &next)) {
-			next.tv_sec += interval.tv_sec;
-			next.tv_nsec += interval.tv_nsec;
-			tsnorm(&next);
-		}
-
 		if (par->max_cycles && par->max_cycles == stat->cycles)
 			break;
 	}
-- 
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux