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

Lee Revell
2004-10-31T02:20:39Z

On Sat, 2004-10-30 at 23:13 +0200, Florian Schmidt wrote:
> On Sat, 30 Oct 2004 16:26:35 -0400
> Lee Revell <rlrevell@joe-job.com> wrote:
>
> > Take a look at the patch I posted to jackit-devel the other day to
> > calculate the CPU speed (previously we grabbed it from /proc/cpuinfo).
> > I just copied the code from realfeel2.
> >
>
> ah, ok.. tarball updated. The third argument is now a percentage. If the
> cycle count difference between two different wakeups differs more than the
> specified percentage from the "perfect" period, then a line is printed to
> the terminal showing by how much percent it differs.
>
> flo
>

Here is a patch that causes the number of consecutive missed interrupts
to be printed, as well as setting RT priority itself instead of relying
on the rt_wakeup wrapper.

I have found that moving the mouse quickly will reliably cause many
interrupts to be missed.

Lee

--- wakeup/wakeup.cc 2004-10-30 17:11:08.000000000 -0400
+++ wakeup2/wakeup.cc 2004-10-30 21:03:21.000000000 -0400
@@ -90,6 +90,22 @@
}
// realfeel

+int set_realtime_priority(void)
+{
+ struct sched_param schp;
+ /*
+ * set the process to realtime privs
+ */
+ memset(&schp, 0, sizeof(schp));
+ schp.sched_priority = sched_get_priority_max(SCHED_FIFO);
+
+ if (sched_setscheduler(0, SCHED_FIFO, &schp) != 0) {
+ perror("sched_setscheduler");
+ exit(1);
+ }
+
+ return 0;
+}

@@ -181,6 +197,8 @@
perror("ioctl");
exit(errno);
}
+
+ set_realtime_priority();

unsigned int irqs = 0;
unsigned int missed_irqs = 0;
@@ -220,7 +238,7 @@
irqs += data;
// std::cout << data << std::endl;
if (data > 1) {
- std::cout << "ouch! we missed one ore more irq[s]" << std::endl;
+ std::cout << "ouch! we missed " << data << " or more irq[s]" << std::endl;
missed_irqs++;
}
}

Lee