Re: [patch] Real-Time Preemption, -RT-2.6.9-mm1-V0

From: Ingo Molnar
Date: Wed Oct 27 2004 - 08:35:06 EST



* K.R. Foley <kr@xxxxxxxxxx> wrote:

> Running amlat [...]

btw., to get good 'realfeel' results i had to apply the attached patch.
Especially when running realfeel over the network it can easily happen
that it's delayed for some time and gets out of sync with the RTC. So
after a new maximum latency has triggered the code now waits 10 periods
to wait for the timings to recover.

this does not hurt the latency measurements in any way - latencies that
occur after these 10 ticks (~5 msecs) are over are still fully measured
and reported.

amlat produces weird output for me, continuously increasing latency
values:

latency = 2967939 milliseconds
latency = 2967950 milliseconds
sigint
max jitter = 0 microseconds

maybe some /dev/rtc API detail changed? Or is this the normal output?

Ingo
--- realfeel.c.orig 2004-10-27 15:04:46.237707040 +0200
+++ realfeel.c 2004-10-27 15:04:50.204104056 +0200
@@ -91,7 +91,7 @@ int set_realtime_priority(void)
* set the process to realtime privs
*/
memset(&schp, 0, sizeof(schp));
- schp.sched_priority = sched_get_priority_max(SCHED_FIFO);
+ schp.sched_priority = sched_get_priority_max(SCHED_FIFO) - 1;

if (sched_setscheduler(0, SCHED_FIFO, &schp) != 0) {
perror("sched_setscheduler");
@@ -191,8 +191,19 @@ int main(int argc, char *argv[])
now = rdtsc();
delay = secondsPerTick * (now - last);
if (delay > max_delay) {
+ int i;
+
max_delay = delay;
printf("%.3f msec\n", 1e3 * (ideal - delay));
+ /*
+ * To make sure that the delay due to the printf
+ * is not counted we skip the next period:
+ */
+ for (i = 0; i < 10; i++)
+ if (read(fd, &data, sizeof(data)) == -1)
+ fatal("blocking read failed");
+ last = rdtsc();
+ continue;
}
ms = (-(ideal - delay) + 1.0/20000.0) * 10000;
if (ms < 0)