Here is the code which I actually used:
int a,b,c, count;
float x,y,z;
a = 342;
b = 567;
x = 3.456;
y = 6.789;
z = 0.0;
c = 0;
iopl(3);
/* asm("cli"); */
count = 10000;
// count = 1000000;
for (long i=0; i<count; i++) {
// c += a+b;
// z += x;
}
/* asm("sti"); */
printf("%d\n", c);
printf("%f\n", z);
So you can see that it will not be optimized out. Here are the stats:
integer adds:
count = 1000000;
interrupts off: 10millisecond
interrupts on: 270 milliseconds
floating point adds (or 100 integer additions inside the loop - cut and
paste c+=a+b; hundred times)
count = 10000;
interrupts off: 10 millisecond
interrupts on: 1000 to 2000 seconds.
-Pawan
----- Original Message -----
From: "Tomasz Motylewski" <[EMAIL PROTECTED]>
To: "Bjorn Eriksson" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>; "Pawan Singh" <[EMAIL PROTECTED]>
Sent: Tuesday, June 27, 2000 4:26 AM
Subject: RE: Timer interrupt processing latency?
> On Tue, 27 Jun 2000, Bjorn Eriksson wrote:
>
> > > double x = 3.4;
> > > double y = 5.67;
> > > double z = 0.0;
> > > for (long i=1; i<10000; i++) {
> > > z += x+y;
> > > }
> > >
> > > printf("%lf\n",z);
>
> > Rewriting so as to not make the code dependent on how smart the
optimizer
> > is. Sound advice which I ASsumed the original poster had though of. I'd
like
>
> Well, I was not concerned about optimizer (but now I am as well).
> I just thought that may be if emulation is done by interrupts, then
blocking
> them just causes no exceptions - no operations beeing done. Therefore I
would
> expect z=0.0 on exit when interrupts are blocked. But I was just guessing.
> Tomek
--
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>.