Print this page
3724 kstat reports idle time as io_wait, kernel as pio_wait, etc


 901         }
 902 }
 903 
 904 static void
 905 save_cpu_stat(kstat_t *kp, ks_instance_t *ksi)
 906 {
 907         cpu_stat_t      *stat;
 908         cpu_sysinfo_t   *sysinfo;
 909         cpu_syswait_t   *syswait;
 910         cpu_vminfo_t    *vminfo;
 911 
 912         stat = (cpu_stat_t *)(kp->ks_data);
 913         sysinfo = &stat->cpu_sysinfo;
 914         syswait = &stat->cpu_syswait;
 915         vminfo  = &stat->cpu_vminfo;
 916 
 917         SAVE_UINT32_X(ksi, "idle", sysinfo->cpu[CPU_IDLE]);
 918         SAVE_UINT32_X(ksi, "user", sysinfo->cpu[CPU_USER]);
 919         SAVE_UINT32_X(ksi, "kernel", sysinfo->cpu[CPU_KERNEL]);
 920         SAVE_UINT32_X(ksi, "wait", sysinfo->cpu[CPU_WAIT]);
 921         SAVE_UINT32_X(ksi, "wait_io", sysinfo->cpu[W_IO]);
 922         SAVE_UINT32_X(ksi, "wait_swap", sysinfo->cpu[W_SWAP]);
 923         SAVE_UINT32_X(ksi, "wait_pio", sysinfo->cpu[W_PIO]);
 924         SAVE_UINT32(ksi, sysinfo, bread);
 925         SAVE_UINT32(ksi, sysinfo, bwrite);
 926         SAVE_UINT32(ksi, sysinfo, lread);
 927         SAVE_UINT32(ksi, sysinfo, lwrite);
 928         SAVE_UINT32(ksi, sysinfo, phread);
 929         SAVE_UINT32(ksi, sysinfo, phwrite);
 930         SAVE_UINT32(ksi, sysinfo, pswitch);
 931         SAVE_UINT32(ksi, sysinfo, trap);
 932         SAVE_UINT32(ksi, sysinfo, intr);
 933         SAVE_UINT32(ksi, sysinfo, syscall);
 934         SAVE_UINT32(ksi, sysinfo, sysread);
 935         SAVE_UINT32(ksi, sysinfo, syswrite);
 936         SAVE_UINT32(ksi, sysinfo, sysfork);
 937         SAVE_UINT32(ksi, sysinfo, sysvfork);
 938         SAVE_UINT32(ksi, sysinfo, sysexec);
 939         SAVE_UINT32(ksi, sysinfo, readch);
 940         SAVE_UINT32(ksi, sysinfo, writech);
 941         SAVE_UINT32(ksi, sysinfo, rcvint);
 942         SAVE_UINT32(ksi, sysinfo, xmtint);
 943         SAVE_UINT32(ksi, sysinfo, mdmint);




 901         }
 902 }
 903 
 904 static void
 905 save_cpu_stat(kstat_t *kp, ks_instance_t *ksi)
 906 {
 907         cpu_stat_t      *stat;
 908         cpu_sysinfo_t   *sysinfo;
 909         cpu_syswait_t   *syswait;
 910         cpu_vminfo_t    *vminfo;
 911 
 912         stat = (cpu_stat_t *)(kp->ks_data);
 913         sysinfo = &stat->cpu_sysinfo;
 914         syswait = &stat->cpu_syswait;
 915         vminfo  = &stat->cpu_vminfo;
 916 
 917         SAVE_UINT32_X(ksi, "idle", sysinfo->cpu[CPU_IDLE]);
 918         SAVE_UINT32_X(ksi, "user", sysinfo->cpu[CPU_USER]);
 919         SAVE_UINT32_X(ksi, "kernel", sysinfo->cpu[CPU_KERNEL]);
 920         SAVE_UINT32_X(ksi, "wait", sysinfo->cpu[CPU_WAIT]);
 921         SAVE_UINT32_X(ksi, "wait_io", sysinfo->wait[W_IO]);
 922         SAVE_UINT32_X(ksi, "wait_swap", sysinfo->wait[W_SWAP]);
 923         SAVE_UINT32_X(ksi, "wait_pio", sysinfo->wait[W_PIO]);
 924         SAVE_UINT32(ksi, sysinfo, bread);
 925         SAVE_UINT32(ksi, sysinfo, bwrite);
 926         SAVE_UINT32(ksi, sysinfo, lread);
 927         SAVE_UINT32(ksi, sysinfo, lwrite);
 928         SAVE_UINT32(ksi, sysinfo, phread);
 929         SAVE_UINT32(ksi, sysinfo, phwrite);
 930         SAVE_UINT32(ksi, sysinfo, pswitch);
 931         SAVE_UINT32(ksi, sysinfo, trap);
 932         SAVE_UINT32(ksi, sysinfo, intr);
 933         SAVE_UINT32(ksi, sysinfo, syscall);
 934         SAVE_UINT32(ksi, sysinfo, sysread);
 935         SAVE_UINT32(ksi, sysinfo, syswrite);
 936         SAVE_UINT32(ksi, sysinfo, sysfork);
 937         SAVE_UINT32(ksi, sysinfo, sysvfork);
 938         SAVE_UINT32(ksi, sysinfo, sysexec);
 939         SAVE_UINT32(ksi, sysinfo, readch);
 940         SAVE_UINT32(ksi, sysinfo, writech);
 941         SAVE_UINT32(ksi, sysinfo, rcvint);
 942         SAVE_UINT32(ksi, sysinfo, xmtint);
 943         SAVE_UINT32(ksi, sysinfo, mdmint);