summaryrefslogtreecommitdiff
path: root/cpp/src/IceGrid/NodeI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IceGrid/NodeI.cpp')
-rw-r--r--cpp/src/IceGrid/NodeI.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/cpp/src/IceGrid/NodeI.cpp b/cpp/src/IceGrid/NodeI.cpp
index 96a9be1cc52..1ed4b525ae4 100644
--- a/cpp/src/IceGrid/NodeI.cpp
+++ b/cpp/src/IceGrid/NodeI.cpp
@@ -25,6 +25,9 @@
# include <sys/sysctl.h>
#elif defined(__hpux)
# include <sys/pstat.h>
+#elif defined(_AIX)
+# include <nlist.h>
+# include <fcntl.h>
#endif
using namespace std;
@@ -241,7 +244,7 @@ NodeI::NodeI(const Ice::ObjectAdapterPtr& adapter,
_last5Total = 0;
_last15Total = 0;
#else
-#if defined(__linux)
+#if defined(__linux) || defined(_AIX)
_nproc = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN));
#elif defined(__APPLE__)
static int ncpu[2] = { CTL_HW, HW_NCPU };
@@ -615,6 +618,24 @@ NodeI::keepAlive()
info.load15 = dynInfo.psd_avg_15_min;
info.nProcessors = dynInfo.psd_proc_cnt;
}
+#elif defined(_AIX)
+ struct nlist nl;
+ nl.n_name = "avenrun";
+ nl.n_value = 0;
+ int kmem;
+ if(knlist(&nl, 1, sizeof(nl)) != 0 && (kmem = open("/dev/kmem", 0, 0)) > 0)
+ {
+ long avenrun[3];
+ if(pread(kmem, avenrun, sizeof(avenrun), nl.n_value) >= sizeof(avenrun))
+ {
+ info.load1 = avenrun[0] / 65535.0f;
+ info.load5 = avenrun[1] / 65535.0f;
+ info.load15 = avenrun[2] / 65535.0f;
+ cerr << info.load1 << endl;
+ }
+ close(kmem);
+ }
+ info.nProcessors = _nproc;
#endif
session->keepAlive(info);
}