* Using table to get system load (Help) ? OSF1/v3.2G
@ 1998-07-28 4:00 Marco Hernandez
0 siblings, 0 replies; only message in thread
From: Marco Hernandez @ 1998-07-28 4:00 UTC (permalink / raw)
Greetings,
I have a piece of code that I want to use to get the current system load. I'm
using the table() interface to do this but for some reason the code either
just exits w/o an error or returns a completely off the wall answer. The
snippet follows ...
#ifdef __osf__
struct tbl_loadavg *tblLoad;
float sysLoad;
int tblScaleVar;
double tblLoadVar;
tblLoad = (struct tbl_loadavg *)malloc(sizeof(struct tbl_loadavg));
if ((table(TBL_LOADAVG,0,tblLoad,1,sizeof(struct tbl_loadavg)))<0)
err_sys("%s: table() failed on TBL_LOADAVG", pname);
syslog(LOG_INFO,"scale %d", tblLoad->tl_lscale);
if ( tblLoad->tl_lscale == 0 ) {
sysLoad = tblLoad->tl_avenrun.l[0];
} else {
tblScaleVar = tblLoad->tl_lscale;
tblLoadVar = tblLoad->tl_avenrun.d[0];
/* it tends to exit at this point ??? */
sysLoad = tblLoad->tl_avenrun.d[0]/tblLoad->tl_lscale;
}
syslog(LOG_INFO,"load %d, %d", tblScaleVar, tblLoadVar);
free (tblLoad);
return (sysLoad);
#endif
Any pointers etc ... are greatly appreciated. Please email any wisdom as
getting to the newsgroups is difficult for me.
Cheers,
Marco Hernandez
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1998-07-28 4:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-07-28 4:00 Using table to get system load (Help) ? OSF1/v3.2G Marco Hernandez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox