perfstat_process Subroutine
Purpose
Retrieves process utilization metrics.
Library
perfstat library (libperfstat.a)
Syntax
#include <libperfstat.h>
perfstat_id_t * name;
perfstat_process_t * userbuff;
int sizeof_userbuff ;
int desired_number ;
Description
The perfstat_process subroutine is the interface for per process utilization metrics. The perfstat_process subroutine retrieves one or more process statistics to populate the perfstat_process_t data structure. If thename and userbuff parameters are specified as NULL, and the desired_elements parameter is stated as 0, the perfstat_process subroutine returns the number of active-processes, excluding the waiting processes. 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.
schedo -p -o proc_disk_stats=1
Parameters
Item | Description |
---|---|
name | Determines whether the statistics must be captured for all the processes or for a specific process. The name parameter, must be set to NULL to obtain the statistics for all processes. For a specific process, the process ID must be mentioned. Note: The
process ID must be passed as a string. For example, to retrieve the
statistics for a process with process ID 5478, the name parameter
must be set to 5478.
|
userbuff | Points to the memory area that is to be filled with one or more perfstat_process_t data structures. |
sizeof_userbuff | Specifies the size of the perfstat_process_t data structure. Note: To obtain the size of the latest version of the perfstat_process_t data
structure, set the sizeof_userbuff parameter to 0, and name and userbuff parameter
to NULL.
|
desired_elements | Specifies the number of perfstat_process_t data structures to copy to the userbuff parameter. |
Return Values
Unless the perfstat_process subroutine is used to retrieve the number of available structures, the number of structures 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 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.