Retrieves individual CPU usage statistics.
perfstat library (libperfstat.a)
#include <libperfstat.h>
The perfstat_cpu subroutine retrieves one or more individual CPU usage statistics. The same function can be used to retrieve the number of available sets of CPU statistics.
To get one or more sets of CPU usage metrics, set the name parameter to the name of the first CPU for which statistics are desired, and set the desired_number parameter. To start from the first CPU, specify "" as the name. The userbuff parameter must always point to a memory area big enough to contain the desired number of perfstat_cpu_t structures that will be copied by this function. Upon return, the name parameter will be set to either the name of the next CPU, or to "" after all structures have been copied.
To retrieve the number of available sets of CPU usage metrics, set the name and userbuff parameters to NULL, and desired_number to 0 (zero). The returned value will be the number of available sets.
Unless the function is used to retrieve the number of available structures, the number of structures filled is returned upon successful completion. Otherwise, a value of -1 is returned and the errno variable is set.
The perfstat_cpu subroutine is unsuccessful if the following is
true:
EINVAL | One of the parameters is not valid. |
The perfstat_cpu subroutine is part of the Base Operating System (BOS) runtime.
/usr/include/libperfstat.h Defines standard macros, data types and subroutines.
The perfstat_cpu_total subroutine, perfstat_memory_total subroutine, perfstat_disk subroutine, perfstat_disk_total subroutine, perfstat_netinterface subroutine, and perfstat_netinterface_total subroutine.