diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2010-05-10 14:23:50 +0200 |
---|---|---|
committer | Clark Williams <williams@redhat.com> | 2010-05-18 12:28:39 -0500 |
commit | 1b3f408a337098ae92da9bd02cb0071745a34832 (patch) | |
tree | 1c4f8bf7b5355f9e64e3bc5d8d4bd29e04dfa11d | |
parent | 9d503b107dedeeb8b3f7e2757745b24128e85d90 (diff) | |
download | rt-tests-1b3f408a337098ae92da9bd02cb0071745a34832.tar.gz |
cyclictest: fix accumulating overruns in periodic timer mode
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>
Signed-off-by: Clark Williams <williams@redhat.com>
-rw-r--r-- | 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) |