perfstat_thread_util Subroutine
Purpose
Calculates thread utilization metrics.
Library
Perfstat Library (libperfstat.a)
Syntax
#include <libperfstat.h>
int perfstat_thread_util (data,userbuff,sizeof_userbuff,desired_number)
perfstat_rawdata_t* data;
perfstat_thread_t* userbuff;
int sizeof_userbuff;
int desired_number;
Description
The perfstat_thread_util subroutine provides the interface for thread utilization metrics. The perfstat_thread subroutine retrieves one or more kernel thread statistics to populate the perfstat_thread_t data structure. The perfstat_thread_util subroutine uses the current and previous values to calculate the utilization metrics.
If the name and userbuff parameters are set to NULL and the sizeof_userbuff parameter is set to 0, the size of the current version of the perfstat_thread_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 perfstat_rawdata_t. The perfstat_rawdata_t data structure uses the current and the previous values to calculate the utilization metrics. |
userbuff | Points to the memory area that is filled with one or more perfstat_thread_t data structures. |
sizeof_userbuff | Specifies the size of the perfstat_thread_t data structure. Note: To
obtain the size of the latest version of the perfstat_thread_t data
structure, set the sizeof_userbuff parameter to 0, and the name and userbuff parameter
to NULL.
|
desired_number | Specifies the number of perfstat_thread_t data structures to copy to the userbuff parameter. |
Return Values
Unless the perfstat_thread_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 subroutine is unsuccessful if the following is true:
Item | Description |
---|---|
EINVAL | One of the parameters is not valid. |
Files
The libperfstat.h file defines standard macros, data types, and subroutines.