[comp.sys.encore] xload for UMAX BSD

jludwig@pinocchio.encore.com (Jim Ludwig) (10/03/90)

Here goes:

add to the include section:

#include <inq_stats/procstats.h>
#include <inq_stats/statistics.h>

static struct proc_summary Proc_sum_data;
static struct stat_descr Proc_info = {
    	NULL,
    	SUBSYS_PROC,
        PROCTYPE_SUMMARY,
        0,
        0,
        (char *) &Proc_sum_data,
        sizeof (struct proc_summary),
        0,
        0};


add to GetLoadPoint:

    int i, j;
    double sum = 0;

    if (inq_stats (1, &Proc_info) != 0) {
                perror ("xload");
                exit (-1);
        }
        for (i = Proc_sum_data.ps_nrunidx, j = 0; j < 12; j++) {
                sum += Proc_sum_data.ps_nrun[i];
                if (--i < 0) i = PS_NRUNSIZE - 1;
        }
        *loadavg  = sum / 12;

        return;


Program must be with group bin and setgid
-rwxr-sr-x  1 root     bin

Enjoy.

This code is supplied without warrenty and Encore makes no promises,
but it does seem to work :-)

Jim Ludwig
X Development Manager
Encore Computer
jludwig@encore.com