From owner-freebsd-current@FreeBSD.ORG Mon Jul 7 08:42:37 2003 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5DF5837B401 for ; Mon, 7 Jul 2003 08:42:37 -0700 (PDT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7567C43FB1 for ; Mon, 7 Jul 2003 08:42:36 -0700 (PDT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.12.9/8.12.9) id h67FgZ0h046648; Mon, 7 Jul 2003 10:42:35 -0500 (CDT) (envelope-from dan) Date: Mon, 7 Jul 2003 10:42:35 -0500 From: Dan Nelson To: Matthias Andree Message-ID: <20030707154235.GD71703@dan.emsphone.com> References: <3F08B199.3050409@comcast.net> <3F08B79B.2040805@gmx.net> <20030707001443.GA1530@invisible-island.net> <20030707002347.GC5141@aurema.com> <20030706203440.D89894@vhost101.his.com> <3F08C4FD.8010107@gmx.net> <3F09663D.9020200@gmx.net> <20030707134031.GG10021@merlin.emma.line.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="ZPt4rx8FFjLCG7dd" Content-Disposition: inline In-Reply-To: <20030707134031.GG10021@merlin.emma.line.org> X-OS: FreeBSD 5.1-CURRENT X-message-flag: Outlook Error User-Agent: Mutt/1.5.4i cc: current@freebsd.org Subject: Re: /dev/shm X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 15:42:37 -0000 --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 dnelson@allantgroup.com --ZPt4rx8FFjLCG7dd Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="top-linux.diff" 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 /* for HZ */ #include /* for PAGE_SHIFT */ -#include /* for NR_TASKS */ +/* #include */ /* for NR_TASKS */ +#define NR_TASKS 8192 #if 0 #include /* 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]; --ZPt4rx8FFjLCG7dd--