Re: interrupt latency

yodaiken
2002-08-28T13:39:29Z

On Wed, Aug 28, 2002 at 08:18:25AM -0400, Richard B. Johnson wrote:
> On Tue, 27 Aug 2002 yodaiken@fsmlabs.com wrote:
>
> > On Tue, Aug 27, 2002 at 04:44:34PM -0400, Richard B. Johnson wrote:
> > > On Tue, 27 Aug 2002 yodaiken@fsmlabs.com wrote:
> > >
>
> [SNIPPED...]B
> >
> > You can do it in a tight loop. But you cannot do it otherwise. RS232 works
> > because most UARTs have fifo buffers. Old Windows did pretty well, because
> > you could grab the machine and let nothing else happen.
> >
> > What makes me dubious about your claim is that it is easy to test
> > and see that a single ISA operation can take 18 microseconds
> > on most PC hardware.
> >
> > try:
> > cli
> > loop:
> > read tsc
> > inb
> > read tsc
> > compute difference
> > print worst case every 1000000 times.
> >
> > sti
> >
> > run for an hour on a busy machine.
> >
> >
>
> No, no, no. There is no such port read that takes 18 microseconds, even
> on old '386 machines with real ISR slots. A port read on those took

Sorry, but the numbers don't lie. It's an easy test to make.
The test you have below tests something else entirely. It tests
average time over a period of something around 1 second.

> (void)alarm(1);
> run++;
> while(run)
> {
> foo[0] = inb(0x378); /* Actually put into memory */
> count++; /* This takes as long as bumping a pointer */
> }
> printf("\nPort reads in a second = %lu\n", count);
> return 0;
> }

Average and worst case are different.