dejnsen@caen.engin.umich.edu (Nik Anthony Gervae) (04/08/91)
I'm looking for a C or Mach function that will get me the percent usage/load of the CPU at any one time. If anyone knows of such a beastie, please email me (or post it I guess). I need it (or something like it) to implement a NeXTstep version of a nifty thing I've seen called xload on Suns here at Michigan....will be my first NS app too.... And FYI: my last posting seems to have got munged. I have uploaded fixrtf to cs.orst.edu and sonata.cc.purdue.edu. They should be in their proper places sometime soon. My apologies to the archive folks if I've done it wrong.... Nik -- / Nik Gervae aka dejnsen@caen.engin.umich.edu | "It'll be finished next week, \ | CS/Linguistics stud. & NeRD at UM (go blow) | I promise!"--me | | | | | **When all else fails, bug someone who | "Just say an iguana chewed | \ knows (not me!). | up your textbook."--Jason Fox /
lane@CAMIS.STANFORD.EDU (Christopher Lane) (04/08/91)
> I'm looking for a C or Mach function that will get me the percent > usage/load of the CPU at any one time. If anyone knows of such a > beastie, please email me (or post it I guess). The function you probably want is 'table'. An example usage from LoadAve.c which is part of the NLoad application: /* 'table()' version of 'loadave()' suggested by Morris Meyer */ #import <c.h> #import <sys/table.h> #define QUEUES 3 extern int table(); int loadave(long vector[QUEUES]) { struct tbl_loadavg tl; int i; if(table(TBL_LOADAVG, 0, &tl, 1, sizeof(tl)) == CERROR) return(CERROR); if(tl.tl_lscale == 0) return(CERROR); for (i = 0; i < QUEUES; i++) vector[i] = tl.tl_avenrun[i]; return(tl.tl_lscale); } >I need it (or something like it) to implement a NeXTstep version of a nifty >thing I've seen called xload on Suns here at Michigan.... Already been done, I'm afraid. It's called 'NLoad' and I promise to have a finished working version for 2.0 on the NeXT archives 'real soon now'. - Christopher -------
simmons@rigel.neep.wisc.edu (Kim Simmons) (04/09/91)
In addition i played around with the Monitor App that worked under 1.0 and
got it working under 2.0, i think. That is it works but i really did't know
exactly what i was doing. If there is any interest i can repost the source
that works (for me) under 2.0, or maybe this is something that the author of
the program should do. The changes were trivial.
--
===============================================================================
Internet: simmons@rigel.neep.wisc.edu
Othernet: simmons@hoofers.lake.mendota
--- ----------------------------------------------------------------------- ---
According to the HitchHikers guide to the galaxy, the one thing we
*cannot* afford to have is a sense of perspective.
===============================================================================