1. The piece of code I am running is a user process.
2. Only reason I tried CLI() and STI() is so that I can find out how much
time does the CPU take to execute the code - just as a benchmark. I will
never use cli and sti in the user land.
3. I finally have one more clue. It does not matter if it is a floating
point operation inside the loop. One gets the same results with integer
operations. The result gets worse and worse depending on the number of
instructions in the loop.
4. I have made sure that compiler has not optimized anything. The piece of
code I typed was just a quick demonstration. Add to the code something after
the loop (like printf) which uses the sum total being produced by the loop.
So in short it seems to me is this - for one integer add:
1. Interrupts turned off: 1000000 integer additions take 10ms.
2. With interrupts turned on 10000000 integer additions take 270ms.
To me it is 27 times kernel overhead.
If I increase the number of integer instructions in the loop to what
floating point code does for two float additions i.e. 100 instructions,
1. Interrupts turned off: 10000 loop interations take 10ms.
2. With interrupts turned on 100000 loop iterations take 1000 to 2000
seconds.
To me in this case it is 100-200 times kernel overhead.
These numbers can be reproduced on any 486, 386 with 8K L1 cache.
Comments?
Thanks
Pawan
[EMAIL PROTECTED]
----- Original Message -----
From: "Kenneth Johansson" <[EMAIL PROTECTED]>
To: "Pawan Singh" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, June 27, 2000 4:07 AM
Subject: Re: How much time is required for proecessing the timer interrupt ?
> Hmm its not exactly clear what you are doing but I have a few points.
>
> 1. You can't use floating point operation inside the kernel unless you
know EXACTLY what you are doing.
>
> 2. I don't know much about x86 but cli/sti must be some type of supervisor
instruction so you can't use them from userspace.
>
> 3. If you are using fpu emulation the emulation is done in an exception
handler thus you can't turn exceptions off(and in userspace it should not be
possible even if you wanted).
>
> 4. you can't modify the time spent in the timer interrupt short of
rewriting it.
>
> 5. I think you are trying to use floating point operations inside the
kernel, you are using kernel emulation code, and you have turned off
exceptions. The result is that the code is not doing anything
> close to what you think its more like an empty loop.
>
> > Pawan Singh wrote:
> >
> > Hi,
> >
> > We are using RedHat 6.0 kernel as the embedded kernel. Only interrupt
enabled is "timer (1)" and "ethernet (14)". We are using AMD SC400 chip.
> >
> > The following piece of code takes 4 seconds to execute with interrupts
turned on:
> >
> > for (i=1; i<10000; i++) {
> > double x = 3.4;
> > double y = 5.67
> > double z = x + y;
> > }
> >
> > If I surround this code with cli and sti (interrupts disabled) it takes
9000 microseconds.
> >
> > When I do cat /proc/interrupts, I only see interrupts going up for
"timer" (once every millisecond) and ethernet once in a while.
> >
> > Does linux kernel spend a lot of time processing timer interrupts? What
is the normal timer interrupt duration on a pentim based workstation? Where
can I modify this parameter in the kernel source
> > code?
> >
> >
> > Thanks
> > Pawan
> > [EMAIL PROTECTED]
--
To unsubscribe from this list, send a message to [EMAIL PROTECTED]
with the command "unsubscribe linux-embedded" in the message body.
For more information, see <http://waste.org/mail/linux-embedded>.