perfstat_disk_total Subroutine
Purpose
Retrieves global disk usage statistics.
Library
Perfstat library (libperfstat.a)
Syntax
#include <libperfstat.h>
perfstat_id_t *name;
perfstat_disk_total_t *userbuff;
size_t sizeof_struct;
int desired_number;
Description
The perfstat_disk_total subroutine returns global disk usage statistics in a perfstat_disk_total_t structure.
To get statistics that are global to the whole system, the name parameter must be set to NULL, the userbuff parameter must be allocated, and the desired_number parameter must be set to 1.
The perfstat_disk_total subroutine retrieves information from the ODM database. This information is automatically cached into a dictionary which is assumed to be frozen once loaded. The perfstat_reset subroutine must be called to flush the dictionary whenever the machine configuration has changed.
To improve system performance, the collection of disk input and output statistics is disabled by default in current releases of AIX®.
chdev -l sys0 -a iostat=true
lsattr -E -l sys0 -a iostat
Another way to enable the collection of the disk input and output statistics is to use the sys_parm API and the SYSP_V_IOSTRUN flag:
struct vario var;
sys_parm(SYSP_GET,SYSP_V_IOSTRUN, &var);
struct vario var;
var.v.v_iostrun.value=1; /* 1 to set & 0 to unset */
sys_parm(SYSP_SET,SYSP_V_IOSTRUN, &var);
Parameters
Item | Description |
---|---|
name | Must set to NULL. |
userbuff | Points to the memory area that is to be filled with one or more perfstat_disk_total_t structures. |
sizeof_struct | Specifies
the size of the perfstat_disk_total_t structure: sizeof(perfstat_disk_total_t) |
desired_number | Must set to 1. |
Return Values
Upon successful completion, the number of structures that could be filled is returned. This is always 1. If unsuccessful, a value of -1 is returned and the errno global variable is set.
Error Codes
The perfstat_disk_total subroutine is unsuccessful if one of the following is true:
Item | Description |
---|---|
EINVAL | One of the parameters is not valid. |
EFAULT | Insufficient memory. |
ENOMEM | The string default length is too short. |
Files
The libperfstat.h file defines standard macros, data types, and subroutines.