perfstat_process_util Subroutine
Purpose
Calculates process utilization metrics.
Library
perfstat library (libperfstat.a
)
Syntax
#include <libperfstat.h>
int perfstat_process (data, userbuff, sizeof_userbuff, desired_number)
perfstat_id_t * data;
perfstat_process_t * userbuff;
int sizeof_userbuff ;
int desired_number ;
Description
The perfstat_process_util subroutine
provides the interface for process utilization metrics. The perfstat_process subroutine
retrieves one or more process statistics to populate the perfstat_process_t
data
structure. The perfstat_process_util subroutine uses the current
and previous values to calculate the utilization-related metrics.
If the name and userbuff parameters are set to NULL,
and the sizeof_userbuff parameter is set to 0, then the size
of the current version of the perfstat_process_t
data structure
is returned. If the desired_number parameter is set to 0, the
number of current elements, from the perfstat_rawdata_t
data
structure, is returned.
Parameters
Item | Description |
---|---|
data |
Specifies that the data parameter is of the type
|
userbuff |
Specifies the memory area to be filled with one or more |
sizeof_userbuff |
Specifies the size of the Note: To obtain the size of the latest version of the data structure
perfstat_process_t , set
the parameter sizeof_userbuff to 0, and the parameters name and userbuff to
NULL. |
desired_number |
Specifies the number of the |
Return Values
Unless the perfstat_process_util subroutine is used to retrieve the number of available structures, the number of structures that are filled is returned upon successful completion. If unsuccessful, a value of -1 is returned and the errno global variable is set.
Error Codes
The perfstat_process_util subroutine is unsuccessful if the following error code is true:
Item | Description |
---|---|
EINVAL |
One of the parameters is not valid. |
Files
The libperfstat.h file defines standard macros, data types, and subroutines.