25 #ifndef CASA_HOSTINFOHPUX_H
26 #define CASA_HOSTINFOHPUX_H
28 # if defined(HOSTINFO_DO_IMPLEMENT)
42 #include <sys/param.h>
43 #include <sys/pstat.h>
73 #define pagetok(size) ((size) << pageshift)
75 class HostMachineInfo {
76 friend class HostInfo;
88 ptrdiff_t memory_total;
89 ptrdiff_t memory_used;
90 ptrdiff_t memory_free;
98 HostMachineInfo::HostMachineInfo( ) :valid(1) {
100 struct pst_static
info;
103 if (pstat_getstatic (&
info,
sizeof (
info), 1, 0) < 0) {
104 perror (
"pstat_getstatic");
113 for (pagesize =
info.page_size; pagesize > 1; pagesize >>= 1)
115 pageshift -= LOG1024;
117 static struct pst_dynamic dynamic;
119 pstat_getdynamic (&dynamic,
sizeof (dynamic), 1, 0);
120 cpus = dynamic.psd_proc_cnt;
121 memory_total = pagetok (dynamic.psd_rm);
124 void HostMachineInfo::update_info( ) {
126 static struct pst_dynamic dynamic;
128 pstat_getdynamic (&dynamic,
sizeof (dynamic), 1, 0);
129 memory_used = pagetok (dynamic.psd_arm);
130 memory_free = memory_total - memory_used;
131 swap_total = pagetok (dynamic.psd_vm);
132 swap_used = pagetok (dynamic.psd_avm);
133 swap_free = swap_total - swap_used;
static HostMachineInfo * info
#define casacore
<X11/Intrinsic.h> #defines true, false, casacore::Bool, and String.