24#ifndef CASA_HOSTINFOIRIX_H
25#define CASA_HOSTINFOIRIX_H
27# if defined(HOSTINFO_DO_IMPLEMENT)
45#include <sys/sysinfo.h>
69#define pagetok(pages) ((((uint64_t) pages) * pagesize) >> 10)
71class HostMachineInfo {
84 ptrdiff_t memory_total;
85 ptrdiff_t memory_used;
86 ptrdiff_t memory_free;
95HostMachineInfo::HostMachineInfo( ) : valid(1) {
97 pagesize = getpagesize();
99 if ((cpus = sysmp(MP_NPROCS)) == -1) {
100 perror(
"sysmp(MP_NPROCS)");
105 struct rminfo realmem;
106 if (sysmp(MP_SAGET, MPSA_RMINFO, &realmem,
sizeof(realmem)) == -1) {
107 perror(
"sysmp(MP_SAGET,MPSA_RMINFO, ...)");
112 memory_total = pagetok(realmem.physmem);
115void HostMachineInfo::update_info( ) {
117 struct rminfo realmem;
118 struct sysinfo sysinfo;
122 swapctl(SC_GETFREESWAP, &fswap);
123 swapctl(SC_GETSWAPTOT, &tswap);
125 if (sysmp(MP_SAGET, MPSA_RMINFO, &realmem,
sizeof(realmem)) == -1) {
126 perror(
"sysmp(MP_SAGET,MPSA_RMINFO, ...)");
131 memory_free = pagetok(realmem.freemem);
132 memory_used = memory_total - memory_free;
133 swap_total = tswap / 2;
134 swap_free = fswap / 2;
135 swap_used = swap_total - swap_free;
this file contains all the compiler specific defines