perfstat_netinterface Subroutine
Purpose
Retrieves individual network interface usage statistics.
Library
Perfstat
Library (libperfstat.a
)
Syntax
#include <libperfstat.h>
int perfstat_netinterface (name, userbuff, sizeof_struct, desired_number)
perfstat_id_t *name;
perfstat_netinterface_t *userbuff;
size_t sizeof_struct;
int desired_number;
Description
The perfstat_netinterface subroutine retrieves one or more individual network interface usage statistics. The same function can also be used to retrieve the number of available sets of network interface statistics.
To get one or more sets of network interface usage metrics, set the name
parameter to the name of the first network interface for which statistics are wanted, and set the
desired_number parameter. To start from the first network interface, set the
name parameter to "" or FIRST_NETINTERFACE. The userbuff
parameter must always point to a memory area large enough to contain the wanted number of
perfstat_netinterface_t
structures that will be copied by this function. Upon
return, the name parameter will be set to either the name of the next network
interface, or to "" after all structures have been copied.
To retrieve the number of available sets of network interface usage metrics, set the name and userbuff parameters to NULL, and the desired_number parameter to 0. The returned value is the number of available sets.
The perfstat_netinterface 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.
This subroutine is not supported inside a workload partition (WPAR). It is not aware of a WPAR.
Parameters
Item | Description |
---|---|
name |
Contains either "", FIRST_NETINTERFACE, or a name identifying the first network interface for
which statistics are wanted. For example;
|
userbuff | Points to the memory area that is to be filled with one or more
perfstat_netinterface_t structures. |
sizeof_struct | Specifies the size of the perfstat_netinterface_t structure:
sizeof(perfstat_netinterface_t) |
desired_number | Specifies the number of perfstat_netinterface_t structures to copy to
userbuff. |
Return Values
Upon successful completion unless the function is used to retrieve the number of available structures, the number of structures that are filled is returned. If unsuccessful, a value of -1 is returned and the errno global variable is set.
Error Codes
The perfstat_netinterface 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.