beostat_count_idle_cpus_on_node

Name

beostat_count_idle_cpus_on_node – count number of idle CPUS on a given node

Synopsis

#include <sys/beostat.h>
int beostat_count_idle_cpus_on_node (int node, float cpu_idle_threshold);

Arguments

node

The node of interest

cpu_idle_threshold

The value of CPU usage below which the CPU will be considered idle.

Description

beostat_count_idle_cpus_on_node executes on the master node and counts the number of CPUs on a given node that have CPU usage below a given threshold.

Examples

int cnt;
cnt = beostat_count_idle_cpus_on_node (3, 0.5);
printf ("Node 3 has %d CPUs below 50% usage.\n", cnt);

Return Value

Returns the number of CPUs on the give node that have usage below the threshold. If an error occurs, it will return -1.

Errors

This function relies on the Beostat subsystem, which consists of the proc filesystem on the remote node, the sendstats daemon on the remote node, the recvstats daemon on the master node, and two shared memory files in the directory /var/shm. If any part of the system breaks down, this function could fail.