Re: interrupt latency

MOLNAR Ingo (mingo@chiara.csoma.elte.hu)
Tue, 11 Aug 1998 02:12:37 +0200 (CEST)


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?

i have once measured the time interrupt routines take away from
user-space. (this is not equal to enter-to-exit latency within the IRQ
routine) The method was to run a tight loop and measure time, and look at
deltas. 'medium' deltas have to be picked out, the small ones are the busy
loop, the big ones are preemption points.

to measure IRQ latency by actively creating a 'request', and measuring the
time it takes to get the effect of the IRQ down into user-space, we have
to find a 'zero-latency' command in the hardware itself. This is quite
hard i think. (something like sending a packet to the same card will get
caught by the card firmware, but Linux filters this out previously
already, unless we are using SOCK_PACKET, which is not portable). (another
method is say the 'setleds' ioctl on x86, because it sends a zero-latency
command to the keyboard which generates an almost immediate IRQ response,
but this is not portable either).

There is an ugly 'separation trick' we can do if we have a network and
CPUs which differ in nothing but MHZ. Say 3 boxes, a 100 MHz, 1 150MHz and
a 200MHz box. By looking at A->B, B->C, C->A, B->A, C->B, A->C lat_udp
latencies and assuming we have the following equation for measured
latency:

udp_lat = send_overhead*MHZ(1) + CONST + recv_overhead*MHZ(2)

we have 6 equations and only 3 unknowns. 'CONST' is the latency of going
over the network plus IRQ latency. IRQ latency is mostly MHZ independent.
(at least on PC hardware)

thus:

CONST = CONST_ETH + CONST_IRQ

and we can estimate the CONST_ETH latency based on bw_udp values and the
physical properties of ethernet networks. Thus we will get 'CONST_IRQ',
voiala.

-- mingo

-
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