comparison src/getloadavg.c @ 82:6a378aca36af r20-0b91

Import from CVS: tag r20-0b91
author cvs
date Mon, 13 Aug 2007 09:07:36 +0200
parents 131b0175ea99
children ac0620f6398e
comparison
equal deleted inserted replaced
81:ebca3d831cea 82:6a378aca36af
565 for (elem = 0; elem < nelem; elem++) 565 for (elem = 0; elem < nelem; elem++)
566 loadavg[elem] = (buf + 6 + elem)->value.ul / 256.0; 566 loadavg[elem] = (buf + 6 + elem)->value.ul / 256.0;
567 free(buf); 567 free(buf);
568 568
569 #endif /* HAVE_KSTAT_H && HAVE_LIBKSTAT */ 569 #endif /* HAVE_KSTAT_H && HAVE_LIBKSTAT */
570
571 #if !defined (LDAV_DONE) && defined (HAVE_SYS_PSTAT_H)
572 #define LDAV_DONE
573 /* This is totally undocumented, and is not guaranteed to work, but
574 mayhap it might .... If it does work, it will work only on HP-UX
575 8.0 or later. -- Darryl Okahata <darrylo@sr.hp.com> */
576 #undef LOAD_AVE_TYPE /* Make sure these don't exist. */
577 #undef LOAD_AVE_CVT
578 #undef LDAV_SYMBOL
579 struct pst_dynamic procinfo;
580 union pstun statbuf;
581
582 statbuf.pst_dynamic = &procinfo;
583 if (pstat (PSTAT_DYNAMIC, statbuf, sizeof (struct pst_dynamic), 0, 0) == -1)
584 return (-1);
585 loadavg[elem++] = procinfo.psd_avg_1_min;
586 loadavg[elem++] = procinfo.psd_avg_5_min;
587 loadavg[elem++] = procinfo.psd_avg_15_min;
588 #endif /* HPUX */
589
570 #endif /* XEMACS */ 590 #endif /* XEMACS */
571 591
572 #if !defined (LDAV_DONE) && defined (__linux__) 592 #if !defined (LDAV_DONE) && defined (__linux__)
573 #define LDAV_DONE 593 #define LDAV_DONE
574 #undef LOAD_AVE_TYPE 594 #undef LOAD_AVE_TYPE