kvm_getcptime
—
fetch global CPU time statistics
Kernel Data Access Library (libkvm, -lkvm)
The kvm_getcptime
() function stores the global CPU time
statistics from the kernel kd in the array of counters
pointed to by cp_time. Note that
cp_time should point to an array of
CPUSTATES
long integers. The format of the counters is
identical to that output by the kern.cp_time sysctl.
This function caches the nlist values for various kernel variables which it
reuses in successive calls. You may call the function with
kd set to NULL
to clear this
cache.
The kvm_getcptime
function returns 0 on success and -1
on failure. If an error occurs, then an error message may be retrieved via
kvm_geterr(3).