[comp.unix.ultrix] Top under the DS5000? Bash memory leak?

hudgens@sun13.scri.fsu.edu (Jim Hudgens) (06/01/90)

Has anyone ported "top" to run under RISC/Ultrix?  In particular,
several quantities which are retrieved from the kernel are 
fixed point, and the output of top is messed up under the 
WCPU, and CPU columns, as well as the load averages being wrong.

I've tried to patch them, but the output still doesn't look right.

Also, in testing "top", I found something which appears to be
a memory leak in BASH 1.05 which happens under DS ULTRIX (3.1d?)
VAX Ultrix (3.1b) but not under SunOS 4.0.3:

   $ while j=0; do j=1; done
   out of swap space, pid 3194, proc bash
   Out of virtual memory!

This machine is configured with 64M of swap.  The sun process does not
grow in size at all.  Total elapsed time is about 5 to 10 minutes.

Sampled output from top (WCPU/CPU columns wrong):

 2860 hudgens   57    0  1256K  960K run     0:13 6614.88% 6600.00% bash
 ...
 2860 hudgens   88    0  3512K 3216K run     0:39 18241.03% 18200.00% bash
 ...
 2860 hudgens   88    0  5768K 5472K run     1:03 22049.59% 22000.00% bash

Any pointers apreciated.  

-- 
standard_disclaimer() { perror("personal opinions only"); exit(1); }
Jim Hudgens			Supercomputer Computations Research Institute
hudgens@vsserv.scri.fsu.edu	

Elliot_Jaffe@TRANSARC.COM (06/04/90)

Here are the diffs for a version of top that works on ultrix.  I started with
a version of top2.5 from ics.uci.edu in unix/top-2.5-sequent.tar.Z.

Enjoy,
Elliot Jaffe
Jaffe@transarc.com

------------------------------------------------------------------------------
diff -r top2.5.sequent/display.c top2.5/display.c
41a42,45
> #ifdef mips
> #include <sys/fixpoint.h>
> #endif
>
99a104,106
> #if defined(mips)
> fix *avenrun;
> #else
101c108,109
< #endif sun
---
> #endif
> #endif
117a126,128
> #if defined(mips)
>           FIX_TO_DBL(avenrun[i]));
> #else
119a131
> #endif
129a142,144
> #if defined(mips)
> fix *avenrun;
> #else
131c146,147
< #endif sun
---
> #endif
> #endif
150a167,169
> #if defined(mips)
>           FIX_TO_DBL(avenrun[i]));
> #else
152a172
> #endif
519a540,542
> #if defined(mips)
> #define percent_cpu(pp) (FIX_TO_DBL((pp)->p_pctcpu))
> #else
520a544
> #endif
diff -r top2.5.sequent/top.c top2.5/top.c
72a73,76
> #ifdef mips
> #include <sys/fixpoint.h>
> #endif
>
211a216,219
> #if defined(mips)
> fix ccpu;
> fix avenrun[3];
> #else
214a223
> #endif
566a576,578
> #if defined(mips)
>     logcpu = log(FIX_TO_DBL(ccpu));
> #else
568a581
> #endif
991a1005,1007
> #if defined(mips)
>                            if (FIX_TO_DBL(avenrun[0]) > LoadMax)
> #else
993a1010
> #endif
1257c1274
< #if !defined(sun) && !defined(sequent)
---
> #if !defined(sun) && !defined(sequent) && !defined(mips)
1266c1283
< #if defined(sun) || defined(sequent)
---
> #if defined(sun) || defined(sequent) || defined(mips)
1280c1297
<              if ((result = p2->p_pri - p1->p_pri) == 0)
---
>              if ((result = p1->p_pri - p2->p_pri) == 0)
1318c1335
< #if !defined(sun) && !defined(sequent)
---
> #if !defined(sun) && !defined(sequent) && !defined(mips)