perfstat_diskpath Subroutine

Purpose

Retrieves individual disk path usage statistics.

Library

Perfstat library (libperfstat.a)

Syntax

#include <libperfstat.h>

int perfstat_diskpath (name, userbuff, sizeof_struct, desired_number)
perfstat_id_t *name;
perfstat_diskpath_t *userbuff
size_t sizeof_struct;
int desired_number;

Description

The perfstat_diskpath subroutine retrieves one or more individual disk path usage statistics. The same function can also be used to retrieve the number of available sets of disk path statistics.

To get one or more sets of disk path usage metrics, set the name parameter to the name of the first disk path for which statistics are desired, and set the desired_number parameter. To start from the first disk path, specify "" or FIRST_DISKPATH as the name parameter. To start from the first path of a specific disk, set the name parameter to the diskname. The userbuff parameter must always point to a memory area big enough to contain the desired number of perfstat_diskpath_t structures that will be copied by this function. Upon return, the name parameter will be set to either the name of the next disk path, or to "" after all structures have been copied.

To retrieve the number of available sets of disk path usage metrics, set the name and userbuff parameters to NULL, and the desired_number parameter to 0. The number of available sets is returned.

The perfstat_diskpath 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®.

To enable the collection of this data, run:
chdev -l sys0 -a iostat=true
To display the current setting, run:
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:

To get the current status of the flag, run the following:
struct vario var;
sys_parm(SYSP_GET,SYSP_V_IOSTRUN, &var);
To set the flag, run the following:
struct vario var;
var.v.v_iostrun.value=1; /* 1 to set & 0 to unset */
sys_parm(SYSP_SET,SYSP_V_IOSTRUN, &var);

This subroutine is not supported inside a workload partition (WPAR). It is not aware of a WPAR.

Parameters

Item Description
name Contains either "", FIRST_DISKPATH, a name identifying the first disk path for which statistics are desired, or a name identifying a disk for which path statistics are desired. For example:
hdisk0_Path2, hdisk1_Path0, ... or hdisk5 (equivalent to hdisk5_Pathfirstpath)
userbuff Points to the memory area to be filled with one or more perfstat_diskpath_t structures.
sizeof_struct Specifies the size of the perfstat_diskpath_t structure: sizeof(perfstat_diskpath_t)
desired_number Specifies the number of perfstat_diskpath_t structures to copy to userbuff.

Return Values

Unless the function 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_diskpath 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.
ENOMSG Cannot access the dictionary.

Files

The libperfstat.h file defines standard macros, data types, and subroutines.