lkml.org 
[lkml]   [1998]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectSome more kernel stats...
Hi people,

I was thinking of adding some more interesting fields to /proc/stat,
starting with a syscall counter, as demonstrated below. Now this happens
to require 1 line of assembly, so I'd appreciate it if some kind souls
could give me versions for the non-i386 platforms. (It's so trivial that
even I could probably work it out by looking at some code, but I'd
rather not place it by accident at some inconvenient spot or something.)

BTW, any other stats that someone would like to see? (Perhaps we could
finally crack that ancient interrupt-handling-reported-as-idle-time
bug somehow.)


Cheers,
Sander

--- linux/arch/i386/kernel/entry.S.~1~ Tue Feb 17 12:51:28 1998
+++ linux/arch/i386/kernel/entry.S Mon Mar 30 23:14:23 1998
@@ -156,6 +156,7 @@
testb $0x20,flags(%ebx) # PF_TRACESYS
jne tracesys
call SYMBOL_NAME(sys_call_table)(,%eax,4)
+ incl kstat # kstat.syscalls++
movl %eax,EAX(%esp) # save the return value
ALIGN
.globl ret_from_sys_call
--- linux/fs/proc/array.c.~1~ Thu Mar 12 10:45:00 1998
+++ linux/fs/proc/array.c Mon Mar 30 23:04:51 1998
@@ -291,10 +291,12 @@
len += sprintf(buffer + len,
"\nctxt %u\n"
"btime %lu\n"
- "processes %lu\n",
+ "processes %lu\n"
+ "syscalls %lu\n",
kstat.context_swtch,
xtime.tv_sec - jiffies / HZ,
- total_forks);
+ total_forks,
+ kstat.syscalls);
return len;
}

--- linux/include/linux/kernel_stat.h.~1~ Fri Mar 6 18:47:34 1998
+++ linux/include/linux/kernel_stat.h Mon Mar 30 23:02:04 1998
@@ -15,6 +15,7 @@
#define DK_NDRIVE 4

struct kernel_stat {
+ unsigned int syscalls; /* Keep this first! (see entry.S) */
unsigned int cpu_user, cpu_nice, cpu_system;
unsigned int per_cpu_user[NR_CPUS],
per_cpu_nice[NR_CPUS],

--
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

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