Re: Counting System Calls [patch]

Sander van Malssen (svm@kozmix.ow.nl)
Mon, 20 Apr 1998 19:15:22 +0200


On Monday, 20 April 1998 at 10:05:01 -0700, Craig Milo Rogers wrote:

> >+ unsigned int syscalls; /* Keep this first! (see entry.S) */
>
> Do you think the counters should be 64 bits wide? They don't
> *need* to be 64 bits wide, because at current processor speeds it'll
> take a few hours to overflow, and a background process could read the
> entries out of /proc and fix up the problem in user space in that
> period.

I'd rather just have 'em 64 bits on 64 bit hardware, and 32 bits on 32
bit hardware. Note that on my system, which admittedly isn't in heavy
use 24 hours a day, the *total* syscall count is always lower than the
IRQ 0 timer tick count, which is good for about 580 days on 32 bit
hardware, IIRC. (But it's true of course that the timer tick doesn't
speed up if the system's continuously in heavy use, as the syscall
counter will do.)

> Also, I note that the IRQ counters are 32 bits wide on i386, and I
> guess people aren't annoyed about overflows there...

Not only the IRQ counters, all the counters from struct kernel_stat
kstat are unsigned ints.

> >+extern int syscall_stat[NR_syscalls];
> >+int syscall_stat[NR_syscalls] = { 0 };
>
> "unsigned int" instead of "int" (or 64-bit wide counters, per
> my comments above)?

Yup, that's just an oversight on my behalf, they're all supposed to be
unsigned ints.

Cheers,
Sander

-- 
Sander van Malssen -- svm@kozmix.ow.nl -- http://svm.www.cistron.nl/
        * The 1-2-5 Page: http://svm.www.cistron.nl/music/ *

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