KVM_CPUSTATS(3) BSD Programmer's Manual KVM_CPUSTATS(3)NAME
kvm_cpustats, kvm_stathz - kernel clock and statistics
SYNOPSIS
#include <sys/param.h>
#include <sys/cpustats.h>
#include <sys/sysctl.h>
#include <kvm.h>
#include <kvm_stat.h>
int
kvm_cpustats(kvm_t *kd, struct cpustats *cp);
int
kvm_stathz(kvm_t *kd);
DESCRIPTION
The kvm_cpustats() function fills in the struct cpustats referenced by cp
with the CPU usage statistics of the kernel indicated by kd.
The struct cpustats structure contains an array of counters describing
the amount of time the kernel has spent in various states. The units of
time used are those returned by kvm_stathz() as described below. The
states are defined as:
CP_USER cpu time spent in user mode
CP_NICE cpu time spent in user mode running niced processes
CP_SYS cpu time spent in system mode
CP_INTR cpu time spent handling interrupts
CP_IDLE cpu time spent in idle mode
The kvm_stathz() function returns the frequency of the kernel statistics
clock, in Hertz (cycles per second).
RETURN VALUES
The kvm_cpustats() function returns zero on success and -1 on failure.
The kvm_stathz() function returns the frequency of the kernel statistics
clock on success or -1 on failure. Upon failure kvm_geterr(3) can be
used to obtain a string describing the error.
SEE ALSOkvm(3), kvm_open(3), kvm_openfiles(3), kvm_close(3), kvm_read(3),
kvm_write(3), kvm_nlist(3), kvm_geterr(3)BSDI BSD/OS May 7, 1997 1