perfstat_node_list Subroutine
Purpose
Retrieves the list of nodes in a cluster.
Library
perfstat library (libperfstat.a)
Syntax
#include <libperfstat.h>
int perfstat_node_list ( name, userbuff, sizeof_userbuff, desired_number)
perfstat_id_node_t *name;
perfstat_node_t *userbuff;
int sizeof_userbuff;
int desired_number;
Description
The perfstat_node_list subroutine returns the list of nodes in a perfstat_node_t structure.
The perfstat_node_list subroutine should be called only after enabling cluster statistics collection by using the following perfstat API call: perfstat_config(PERFSTAT_ENABLE | PERFSTAT_CLUSTER_STATS, NULL).
The cluster statistics collection must be disabled after collecting the node list by using the following perfstat API call: perfstat_config(PERFSTAT_DISABLE | PERFSTAT_CLUSTER_STATS, NULL).
To obtain the total number of nodes in a cluster (in which the current node is participating), the cluster name must be specified in the name parameter, the userbuff parameter must be specified as NULL and the desired_number parameter must be specified as zero.
To obtain the list of nodes in a particular cluster (in which the current node is participating), the cluster name must be specified in the name parameter. The userbuff parameter must be allocated. The desired_number parameter must be set.
Parameters
Item | Description |
---|---|
name.nodenamename.spec | Specifies the cluster name. Specifies the Cluster ID specifier. Should be set to CLUSTERNAME. |
userbuff | Specifies the memory area that is to be filled with the perfstat_node_t structure. |
sizeof_userbuff | Specifies the size of the perfstat_node_t structure. |
desired_number | Specifies the number of structures to be returned. |
Return Values
Unless the perfstat_node_list subroutine 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 subroutine is unsuccessful if the following is true:
Item | Description |
---|---|
EINVAL | One of the parameters is not valid. |
ENOENT | Either cluster statistics collection is not enabled using perfstat_config or cluster statistics collection is currently not supported. |
Files
The libperfstat.h file defines standard macros, data types, and subroutines.