[comp.unix.xenix] loadst bug on Xenix systems

kayvan@mrspoc.Transact.COM (Kayvan Sylvan) (07/22/89)

Following a recent posting about avenrun on comp.unix.xenix,

> From nick@qtnet.uucp Fri Jul 21 14:50:21 1989
> From: nick@qtnet.uucp (Nick Lawes)
> 
> Avenrun is an array of three shorts. These represent (I believe) the load
> average over the last 1, 5, and 10 minutes. Divide the required short by
> 256.0 to get the load average.

I looked at the code in m-intel386.h (since I kept being annoyed at the
rather large "load average" values that loadst returned). Sure enough,
there lots of magic in m-intel386.h that needed to be fixed.

I made some changes and recompiled loadst and now it returns exactly the
same values as the Xenix "w" command. Thanks, Nick!

*** m-intel386.h~	Fri Jul 21 16:23:35 1989
--- m-intel386.h	Fri Jul 21 16:23:35 1989
***************
*** 74,78
  #ifdef XENIX
  /* Data type of load average, as read out of kmem.  */
! #define LOAD_AVE_TYPE long
  
  /* Convert that into an integer that is 100 for a load average of 1.0  */

--- 74,78 -----
  #ifdef XENIX
  /* Data type of load average, as read out of kmem.  */
! #define LOAD_AVE_TYPE short
  
  /* Convert that into an integer that is 100 for a load average of 1.0  */
***************
*** 77,81
  
  /* Convert that into an integer that is 100 for a load average of 1.0  */
! #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
    
  #define FSCALE 400000.0         /* determined by experimentation...  */

--- 77,81 -----
  
  /* Convert that into an integer that is 100 for a load average of 1.0  */
! #define LOAD_AVE_CVT(x) (((double) (x)) * 100.0 / FSCALE)
    
  #define FSCALE 256.0         /* determined by experimentation...  */
***************
*** 79,83
  #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
    
! #define FSCALE 400000.0         /* determined by experimentation...  */
  #endif
  

--- 79,83 -----
  #define LOAD_AVE_CVT(x) (((double) (x)) * 100.0 / FSCALE)
    
! #define FSCALE 256.0         /* determined by experimentation...  */
  #endif
  
-- 
Kayvan Sylvan @ Transact Software, Inc. -*-  Mountain View, CA (415) 961-6112
Internet: kayvan@Transact.COM -*- UUCP: ...!{apple,pyramid,mips}!mrspoc!kayvan