diff --git a/src/os/osf1/osf1_sigar.c b/src/os/osf1/osf1_sigar.c index e6f9732f..3d47649b 100644 --- a/src/os/osf1/osf1_sigar.c +++ b/src/os/osf1/osf1_sigar.c @@ -89,9 +89,25 @@ int sigar_uptime_get(sigar_t *sigar, int sigar_loadavg_get(sigar_t *sigar, sigar_loadavg_t *loadavg) { - loadavg->loadavg[0] = -1; - loadavg->loadavg[1] = -1; - loadavg->loadavg[2] = -1; + int i; + struct tbl_loadavg avg; + + if (table(TBL_LOADAVG, 0, &avg, 1, sizeof(avg)) < 0) { + return errno; + } + + if (avg.tl_lscale) { + for (i=0; i<3; i++) { + loadavg->loadavg[i] = + ((double)avg.tl_avenrun.l[i] / + (double)avg.tl_lscale); + } + } + else { + for (i=0; i<3; i++) { + loadavg->loadavg[i] = avg.tl_avenrun.d[i]; + } + } return SIGAR_OK; } diff --git a/src/os/osf1/sigar_os.h b/src/os/osf1/sigar_os.h index 378270fd..147a4ede 100644 --- a/src/os/osf1/sigar_os.h +++ b/src/os/osf1/sigar_os.h @@ -7,6 +7,7 @@ #undef usr #undef sys +#include #include #include