Sleep about one microsecond and outb on 0x80

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View
Hello,
I want to use delays of 1 microsend on linux 2.4 or linux 2.6 kernel
on x386 platform.

As we know, usleep depends on the HZ of the system.

So both in  2.4 and in 2.6 we cannot achieve 1 microsec delay calling
udelay (the man page of usleep says itslef that
"Probably  not accurate on many machines down to the microsecond.").

According to "Linux I/O port programming mini-HOWTO"
(http://www.tldp.org/HOWTO/IO-Port-Programming-2.html )
you can use outb on 0x80 to create a dealy.

So I added this snippest of code
and trird to use outb('a',0x80) for creating a sleep time in
    resolution of microseconds thus:
............

       ioperm(0x80, 1, 1);

       for (i=0;i<10000;i++)
                outb('a',0x80);
............


On 3 machines (each of them had a different strength, one of the with
2.6
kernel and the other two with 2.6 kernek) it gave a result of
about 1.4 microsec for every such call, while on a differnet macine it
gave a much
higher average of 2.16 microsec.

That different machine was a strong one, with 3Ghz CPU.

Quoted text here. Click to load it
creating a
microsec delay because it gives such different results on different
machines.
However , the results seems strange :
I have 2 almost similiar machines :
one gave 2.16 and one gave 1.4

Could it be that something in that machine caused it to do it slower
and gicv 2.16 microsec as an average?

I must empasize that "top" showed that there did not run something
heavy on
both these machines.(in terms of cpu and memory)

Any idea?

John Que


Re: Sleep about one microsecond and outb on 0x80

Quoted text here. Click to load it

You can tune the loop by using the accurate timer.

Quoted text here. Click to load it

How many times did you run the test?  What is the spread of the results?



Site Timeline