Re: Question on /proc/interrupts

Richard B. Johnson (root@chaos.analogic.com)
Mon, 13 Apr 1998 13:12:14 -0400 (EDT)


On Mon, 13 Apr 1998, Meino Christian Cramer wrote:

> Hi!
>
> Short question on /proc/interrupts.
>
> If I do a "cat /proc/interrupts" I get:
>
> 0: 2747188 XT PIC timer
> 1: 12958 XT PIC keyboard
> 2: 0 XT PIC cascade
> 4: 288563 XT PIC serial
> 8: 0 XT PIC rtc
> 9: 45153 XT PIC ncr53c8xx
> 13: 1 XT PIC fpu
>
> ^^^^^^^
> Assuming that this is a counter of interrupts happened so far, I am
> wondering, why the counter for the fpu-interrupts still is "1", even
> if I have done such heavy calculating stuff like rendering or raytracing
> (bmrt/povray). MATH_EMULATION of the kernel is switched off, I am
> using a AMD K6.
>
> What happens here?

The FPU interrupt happens upon an exception. Your programs probably didn't
create any Infs, Nans, div/0, etc.

To test, make a program that divides by zero, make sure that gcc
doesn't optimize it so that execution never occurs, i.e., make
your zero like:

float x=100.0;
float y=100.0;
float z;

z = x - y;
y /= z;

This <may> make the FPU interrupt count change. It probably won't
because most of the FPU exceptions are masked off by default. Therefore
you would have to change the flags in the FPU unit. Here is how to
do that and, incidentally, generate a FPU exception.

/*
* Note FPU control only exists per process. Therefore, you have
* to set up the FPU before you use it in any program or child
* process.
*/
#include <i386/fpu_control.h>

#define FPU_MASK (_FPU_MASK_IM |\
_FPU_MASK_DM |\
_FPU_MASK_ZM |\
_FPU_MASK_OM |\
_FPU_MASK_UM |\
_FPU_MASK_PM)

void fpu()
{
__setfpucw(_FPU_DEFAULT & ~FPU_MASK);
}

main() {
double zero=0.0;
double one=1.0;
fpu();

one /=zero;
}

Cheers,
Dick Johnson
***** FILE SYSTEM MODIFIED *****
Penguin : Linux version 2.1.92 on an i586 machine (66.15 BogoMips).
Warning : It's hard to remain at the trailing edge of technology.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu