beostat_get_cpu_percent

Name

beostat_get_cpu_percent – get the CPU usage on a node

Synopsis

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

Arguments

node

The node to query

cpu

The CPU index on the particular node

Description

beostat_get_cpu_percent executes on the master node and returns the current CPU usage as a floating-point value between 0.0 and 1.0.

Examples

printf ("CPU 0 on node 3 is %f percent busy.\n", beostat_get_cpu_percent (3, 0));

Return Value

Return a float between 0.0 and 1.0. If an error occurs, it will return -1.0.

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.