From: mahern@digi-ham.new-york.ny.usa (Marco Hernandez)
Subject: Using table to get system load (Help) ? OSF1/v3.2G
Date: 1998/07/28 [thread overview]
Message-ID: <6pjcv4$6ue$1@winter.news.erols.com> (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
reply other threads:[~1998-07-28 4:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox