In the last episode (Jul 07), Matthias Andree said: > Marcin Dalecki schrieb am 2003-07-07: > > Matthias Andree wrote: > > >Update your Linux top or run fewer processes on it then. :-> > > > > You know that file system name lookup is one of the most expensive > > system calls under UNIX? > > So what? If you don't like the interface because it does ever so > expensive file system lookups (I wonder what's so expensive if no > disk drive latencies are involved), suggest a better one and donate > an implementation. > > I'm sure I'd find disadvantages of non-Linux top if I only cared to > look. I don't. It works when I need it, it's not in my way otherwise, > that's as much as I care.
There is already a functional non-procfs implementation that has been around long before procps top: groupsys top 3.5b12 (i.e. the top that all other non-Linux systems use) compiles fine on even the newest Linux kernels with the attached patch. It's one of the first things I build on a new Linux box. Procps top is way too slow; it takes a full 5 seconds just for the first screen refresh on a mostly-idle box with 400 processes. groupsys top is basically instantaneous. And don't think about accidentally hitting a cursor or function key which running procps top; it doesn't even use curses, so it beeps and waits 2 seconds for each character in the escape sequence :) -- Dan Nelson [EMAIL PROTECTED]
diff -burp top-3.5beta12/display.c top-3.5beta12-l/display.c --- top-3.5beta12/display.c Thu Sep 12 15:24:39 1996 +++ top-3.5beta12-l/display.c Mon Apr 29 12:45:54 2002 @@ -931,12 +931,12 @@ register char **pp; static void summary_format(str, numbers, names) char *str; -int *numbers; +unsigned int *numbers; register char **names; { register char *p; - register int num; + register unsigned int num; register char *thisname; register int useM = No; @@ -946,6 +946,8 @@ register char **names; { /* get the number to format */ num = *numbers++; + +/* fprintf(stderr,"%lu\n",num); */ /* display only non-zero numbers */ if (num > 0) diff -burp top-3.5beta12/machine/m_linux.c top-3.5beta12-l/machine/m_linux.c --- top-3.5beta12/machine/m_linux.c Fri Jan 15 08:42:07 1999 +++ top-3.5beta12-l/machine/m_linux.c Mon Apr 29 12:45:54 2002 @@ -36,7 +36,8 @@ #include <sys/param.h> /* for HZ */ #include <asm/page.h> /* for PAGE_SHIFT */ -#include <linux/tasks.h> /* for NR_TASKS */ +/* #include <linux/tasks.h> */ /* for NR_TASKS */ +#define NR_TASKS 8192 #if 0 #include <linux/proc_fs.h> /* for PROC_SUPER_MAGIC */ @@ -139,7 +140,7 @@ static struct top_proc **nextactive; static int cpu_states[NCPUSTATES]; static int process_states[NPROCSTATES]; -static int memory_stats[NMEMSTATS]; +static unsigned int memory_stats[NMEMSTATS]; /* usefull macros */ #define bytetok(x) (((x) + 512) >> 10) diff -burp top-3.5beta12/screen.c top-3.5beta12-l/screen.c --- top-3.5beta12/screen.c Wed Dec 15 11:44:10 1993 +++ top-3.5beta12-l/screen.c Mon Apr 29 12:45:54 2002 @@ -71,7 +71,6 @@ char *start_standout; char *end_standout; char *terminal_init; char *terminal_end; -short ospeed; #ifdef SGTTY static struct sgttyb old_settings; diff -burp top-3.5beta12/utils.c top-3.5beta12-l/utils.c --- top-3.5beta12/utils.c Mon Jun 1 12:58:17 1998 +++ top-3.5beta12-l/utils.c Mon Apr 29 12:45:54 2002 @@ -59,27 +59,16 @@ char *str; char *itoa(val) -register int val; +register unsigned int val; { - register char *ptr; static char buffer[16]; /* result is built here */ /* 16 is sufficient since the largest number we will ever convert will be 2^32-1, which is 10 digits. */ - ptr = buffer + sizeof(buffer); - *--ptr = '\0'; - if (val == 0) - { - *--ptr = '0'; - } - else while (val != 0) - { - *--ptr = (val % 10) + '0'; - val /= 10; - } - return(ptr); + sprintf(buffer,"%lu",val); + return buffer; } /* @@ -437,7 +426,7 @@ long seconds; char *format_k(amt) -int amt; +unsigned int amt; { static char retarray[NUM_STRINGS][16];
_______________________________________________ [EMAIL PROTECTED] mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "[EMAIL PROTECTED]"