Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug in kstat, cpu_stat?

31 views
Skip to first unread message

Daniel Berger

unread,
Nov 8, 2004, 3:06:17 PM11/8/04
to
Hi all,

Solaris 9

I'm getting different results from the kstat command line tool and the
kstat library.

>kstat -m cpu_stat
...
wait 8610
wait_io 8610
wait_pio 0
wait_swap 0

Then I tried this bit of C code:

/* Build with '-l kstat' */
#include <sys/sysinfo.h>
#include <kstat.h>
#include <stdio.h>

int main(){
kstat_ctl_t* kc;
kstat_t* ksp;
cpu_sysinfo_t* cptr;

/* cpu_stat is a KSTAT_TYPE_RAW */
kc = kstat_open();
ksp = kstat_lookup(kc,"cpu_stat",0,NULL);

kstat_read(kc,ksp,NULL);

cptr = (cpu_sysinfo_t *)ksp->ks_data;

printf("wait_io: %u\n",cptr->wait[W_IO]);
printf("wait_pio: %u\n",cptr->wait[W_PIO]);
printf("wait_swap: %u\n",cptr->wait[W_SWAP]);

kstat_close(kc);
return 0;
}

With this I get the following output:

wait_io: 23184
wait_pio: 8610
wait_swap: 8610

Also, should the plain 'wait' statistic be the sum of these three? Or
have I misinterpreted what these values should be?

Regards,

Dan

0 new messages