* [PATCH] cyclictest: fix accumulating overruns in periodic timer mode
@ 2010-05-10 12:23 Michal Schmidt
0 siblings, 0 replies; only message in thread
From: Michal Schmidt @ 2010-05-10 12:23 UTC (permalink / raw)
To: linux-rt-users; +Cc: Clark Williams, John Kacur
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@juffo.org>
Signed-off-by: Michal Schmidt <mschmidt@redhat.com>
---
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)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-05-10 12:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-10 12:23 [PATCH] cyclictest: fix accumulating overruns in periodic timer mode Michal Schmidt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).