Hi,

The load metric on AIX was not working properly, so to make it work I modified
gmond/machines/aix.c to use libperfstat of AIX. For the modifications to work
the AIX must have "bos.perf.libperfstat" installed and link with "-lperfstat".

I used the following URLs to help me:
http://publib16.boulder.ibm.com/pseries/en_US/files/aixfiles/libperfstat.h.htm
http://publib16.boulder.ibm.com/pseries/en_US/libs/basetrf1/perfstat_cputot.htm

The same stuff could be used to fixed the other metrics, for the moment I was
only interested in the load.

#### diff of gmond/machines/aix.c ###########################################
713,722c713,718
< #include <sys/proc.h>
< #include <libperfstat.h>
<   perfstat_id_t *name;
<   perfstat_cpu_total_t *userbuff;
<   size_t sizeof_struct;
<   int desired_number;
<   name = NULL;
<   desired_number = 1;
<   sizeof_struct=sizeof(perfstat_cpu_total_t);
<   userbuff=(perfstat_cpu_total_t *)malloc(sizeof_struct);
---
>     static int initted=0;
>     int avenrun[3];
>     static struct nlist knames[] = {
>           {"avenrun", 0, 0, 0, 0, 0},
>           {NULL, 0, 0, 0, 0, 0}
>       };
724c720
<   perfstat_cpu_total (name, userbuff, sizeof_struct, desired_number);
---
>     static int no_avenrun_here = 0;
726,728c722,738
<        loadv[0] = (double)((userbuff->loadavg)[0])*1.0/( 1 << SBITS );
<        loadv[1] = (double)((userbuff->loadavg)[1])*1.0/( 1 << SBITS );
<        loadv[2] = (double)((userbuff->loadavg)[2])*1.0/( 1 << SBITS );
---
>     if (no_avenrun_here)
>         return -1;
>
>     if (!initted) {
>         initted = 1;
>         if (knlist(knames, 1, sizeof(struct nlist)) == -1){
>             no_avenrun_here = 1;
>             return -1;
>         }
>     }
>     getkmemdata(&avenrun, sizeof(avenrun), (caddr_t) knames->n_value);
>     if (nelem > 0)
>        loadv[0] = avenrun[0] / 65536.0;
>     if (nelem > 1)
>        loadv[1] = avenrun[1] / 65536.0;
>     if (nelem > 2)
>        loadv[2] = avenrun[2] / 65536.0;

-- 
Richard Lefebvre, Sys-admin, RQCHP, (514)343-6111 x5313      "Don't Panic"
Richard.Lefebvre(@AROBAS)rqchp.qc.ca                            -- THGTTG

Reply via email to