[3999] in Athena Bugs

home help back first fref pref prev next nref lref last post

zhm stats "size"

daemon@ATHENA.MIT.EDU (John Carr)
Wed Jan 17 21:53:33 1990

To: bugs@ATHENA.MIT.EDU, bug-zephyr@ATHENA.MIT.EDU
Date: Wed, 17 Jan 90 21:53:10 EST
From: John Carr <jfc@ATHENA.MIT.EDU>

zhm returns sbrk(0) as the size of the running program when queried by
zstat.  This is only close on a vax.  On an RT it is off by 256
megabytes.  Zhm should either not return this field, or the following
patch should be applied:

*** src/zhm.c	Mon Dec 18 13:20:20 1989
--- zhm.c	Wed Jan 17 21:48:57 1990
***************
*** 426,431 ****
--- 426,432 ----
       char *bfr;
       char *list[20];
       int len, i, nitems = 10;
+      unsigned int size;
  
       newnotice = *notice;
       
***************
*** 454,461 ****
  	  (void)sprintf(list[6], "no");
       list[7] = (char *)malloc(64);
       (void)sprintf(list[7], "%ld", time((time_t *)0) - starttime);
       list[8] = (char *)malloc(64);
!      (void)sprintf(list[8], "%ld", (long)sbrk(0));
       list[9] = (char *)malloc(32);
       (void)strcpy(list[9], MACHINE);
  
--- 455,475 ----
  	  (void)sprintf(list[6], "no");
       list[7] = (char *)malloc(64);
       (void)sprintf(list[7], "%ld", time((time_t *)0) - starttime);
+      size = (unsigned int)sbrk(0);
+ #ifdef ibm032
+      size -= 0x10000000;
+ #endif
+ #ifdef i386
+      size -= 0x800000;
+ #endif
+ #ifdef vax
+      {
+        extern int etext;
+        size -= (unsigned int) &etext;
+      }
+ #endif
       list[8] = (char *)malloc(64);
!      (void)sprintf(list[8], "%ld", size);
       list[9] = (char *)malloc(32);
       (void)strcpy(list[9], MACHINE);
  


home help back first fref pref prev next nref lref last post