Re: interrupt latency

Oliver Xymoron (oxymoron@waste.org)
Tue, 11 Aug 1998 11:41:53 -0500 (CDT)


On Mon, 10 Aug 1998, Larry McVoy wrote:

> : >Are there and patches/utilities/anything to measure interrupt latency
> : >under linux ?
> :
> : The easiest way to measure interrupt latency is with a signal generator
> : and an oscilloscope. No software solution is likely to give good results.
>
> I reall wish this wasn't the case because I would dearly love to be able to
> have interrupt latency as a benchmark test in lmbench. Are you sure there
> is no way to do this in software? What if you had some way to generate
> interrupts essentially continuously?

You've got four events:

A software trigger an interrupt to occur
B PIC raises interrupt
C handler acknowledges interrupt
D software acknowledges interrupt

C-B is the time you're interested in, but D-A is the only information you
have direct access to. You can also do continuous polling of hires clocks
from user space looking for dropouts to find D-B approximately. This still
leaves you wondering when C occurs, unless you timestamp this as well,
which is not generally done.

Something just occurred to me: you can measure latency by making a broken
interrupt handler. Generate a single interrupt (say clock), handle it,
acknowledge it incorrectly (so that you've done the same work as you would
otherwise do to ack it, but you've failed to clear it), then unmask
interrupts as usual. You will be immediately reinterrupted until you
properly acknowledge it. On the thousandth iteration, acknowledge it
correctly. Divide time taken (on the cycle counter, not interrupt-based
jiffies of course) by 1000 to determine latency (+amortized setup time).
The handler has to be slightly more complex than the null handler - it has
to do a countdown and possibly keep the kernel stack from overflowing.

Would be kindof cute to measure this along with BogoMIPs.

At any rate, no sign of a userspace solution in sight.

--
 "Love the dolphins," she advised him. "Write by W.A.S.T.E.." 

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html