[PATCH] cyclictest: fix accumulating overruns in periodic timer mode

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

 



When using a POSIX interval timer and an overrun occurs, a signal is always
lost. From then on cyclictest would report all measurements as increased by
N*period (where N is the number of overruns).

cyclictest can detect the overruns and adjust the expected time of the next
tick accordingly.

Reported-by: Marti Raudsepp <marti@xxxxxxxxx>
Signed-off-by: Michal Schmidt <mschmidt@xxxxxxxxxx>
---

 src/cyclictest/cyclictest.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/src/cyclictest/cyclictest.c b/src/cyclictest/cyclictest.c
index 3a7e752..6829d34 100644
--- a/src/cyclictest/cyclictest.c
+++ b/src/cyclictest/cyclictest.c
@@ -713,6 +713,11 @@ void *timerthread(void *param)
 
 		next.tv_sec += interval.tv_sec;
 		next.tv_nsec += interval.tv_nsec;
+		if (par->mode == MODE_CYCLIC) {
+			int overrun_count = timer_getoverrun(timer);
+			next.tv_sec += overrun_count * interval.tv_sec;
+			next.tv_nsec += overrun_count * interval.tv_nsec;
+		}
 		tsnorm(&next);
 
 		if (par->max_cycles && par->max_cycles == stat->cycles)

--
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