RSET Interfaces

The RSET interface reports processor metrics related to an RSET.

All of the following AIX® 6.1 RSET interfaces use the naming convention perfstat_subsystem[_total]_rset, and use a common signature:
Item Descriptor
perfstat_cpu_total_rset Retrieves processor summary metrics of the processors in an RSET
perfstat_cpu_rset Retrieves per processor metrics of the processors in an RSET

The signature used by the previousperfstat_memory_page_wpar Interface is as follows:

int perfstat_cpu_rset(perfstat_wpar_id_t *name,

                       perfstat_cpu_t * userbuff,

                       int sizeof_struct,

                       int desired_number);


int perfstat_cpu_total_rset(perfstat_wpar_id_t *name,

                       perfstat_cpu_total_t * userbuff,

                       int sizeof_struct,

                       int desired_number);

The usage of the parameters for all of the interfaces is as follows:

Item Descriptor
perfstat_id_wpar_t *name Specifies the RSET identifier and the name of the first component (for example, cpu0) for which statistics are desired. A structure containing the specifier, which can be an RSETHANDLE, WPARID, or WPARNAME, a union to specify the wpar ID, or wpar name or rsethandle and a char * field to specify the name of the first component. To start from the first component of a subsystem, set the char* field of the name parameter to "" (empty string). You can also use the macro FIRST_CPU defined in the libperfstat.h file.
perfstat_cpu[_total]_t *userbuff A pointer to a memory area with enough space for the returned structures.
int sizeof_struct Should be set to sizeof(perfstat_cpu[_total]_t).
int desired_number The number of structures of type perfstat_cpu[_total]_t to return in userbuff.

The number of structures copied and returned without errors uses the return value of 1. If there are errors, the return value is -1. The field name is either set to NULL or to the name of the next structure available.

An exception to this scheme is when name=NULL, userbuff=NULL, and desired_number=0, the total number of structures available is returned.

To retrieve all structures of a given type, either ask first for their number, allocate enough memory to hold them all at once, then call the appropriate API to retrieve them all in one call. Else, allocate a fixed set of structures and repeatedly call the API to get the next such number of structures, each time passing the name returned by the previous call. Start the process with the name set to "" or FIRST_CPU, and repeat the process until the name returned is equal to "".

The following sections provide examples of the type of data returned and code using each of the interfaces.