[lkml]   [1998]   [Apr]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Counting System Calls [patch]
>> 	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

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

 \ /
  Last update: 2005-03-22 13:42    [W:0.105 / U:2.704 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site