beostat_get_meminfo

Name

beostat_get_meminfo -- get information about the memory usage on a node

Synopsis

#include <sys/beostat.h>

int beostat_get_meminfo (int node, struct beostat_meminfo *meminfo);

Arguments

node

The node to query

meminfo

A pointer to a struct beostat_meminfo which is defined as :

struct beostat_meminfo
{
  struct beostat_memusage mem;
  struct beostat_memusage swap;
  unsigned long long shared;
  unsigned long long buffers;
  unsigned long long cached;
};
where struct beostat_memusage is defined as:
struct beostat_memusage
{
  unsigned long long used;
  unsigned long long free;
};

Description

beostat_get_meminfo will get the memory usage of a node in the cluster. All values are in bytes.

Warning: Since Linux aggressively caches the hard disk into memory it will often appear to always be about 90% used. Some have suggested that the values of buffers and cached added together should be subtracted from the reported memory usage. However, these values may not be mutually exclusive.

Example:

meminfo_t meminfo;
beostat_get_meminfo (3, &meminfo);
printf ("The node 3 has %s bytes free\n", meminfo.mem.free);

Return Value

Return 0 on success. 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 sendstatsdaemon 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.