From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,363e06ee28530e6a,start X-Google-Attributes: gidfee84,public 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 Message-ID: <6pjcv4$6ue$1@winter.news.erols.com>#1/1 X-Deja-AN: 375519906 X-Complaints-To: abuse@rcn.com X-Trace: winter.news.erols.com 901592868 7118 207.172.91.71 (28 Jul 1998 02:27:48 GMT) Organization: Digital Hammer Corp Newsgroups: comp.unix.osf.osf1 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