Re: Counting System Calls [patch]

Craig Milo Rogers (rogers@ISI.EDU)
Mon, 20 Apr 1998 10:05:01 -0700


>> Has anyone created entry.S code to count system calls (per
>> syscall number), and /proc code to read these counts?
>
>Here ya go. Info goes to /proc/syscalls (and a totals counter sits in
>/proc/stat, just to be gratuitous). A Q&D pretty-printer might look like
>this:

Wow! Thanks! However...

>+ incl kstat # kstat.syscalls
>+ incl syscall_stat(,%eax,4) # syscall counter
...
>+ 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. Also, I note that the IRQ counters are 32 bits wide on i386,
and I guess people aren't annoyed about overflows there...

>+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)?

Craig Milo Rogers

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