diff options
author | Benoit Foucher <benoit@zeroc.com> | 2005-09-27 13:22:05 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2005-09-27 13:22:05 +0000 |
commit | eff6a7af8e73573e8a1cbb6cd23249f0a9cd9e7f (patch) | |
tree | 2c18eccdb121e6f58b9e4e4a0f414e3983855804 /cpp/src/IceGrid/NodeCache.cpp | |
parent | Fixes (diff) | |
download | ice-eff6a7af8e73573e8a1cbb6cd23249f0a9cd9e7f.tar.bz2 ice-eff6a7af8e73573e8a1cbb6cd23249f0a9cd9e7f.tar.xz ice-eff6a7af8e73573e8a1cbb6cd23249f0a9cd9e7f.zip |
Fixes to support a little more information for nodes.
Diffstat (limited to 'cpp/src/IceGrid/NodeCache.cpp')
-rw-r--r-- | cpp/src/IceGrid/NodeCache.cpp | 37 |
1 files changed, 35 insertions, 2 deletions
diff --git a/cpp/src/IceGrid/NodeCache.cpp b/cpp/src/IceGrid/NodeCache.cpp index 71ce116284b..0b59a2106d2 100644 --- a/cpp/src/IceGrid/NodeCache.cpp +++ b/cpp/src/IceGrid/NodeCache.cpp @@ -137,11 +137,22 @@ NodeEntry::getProxy() const Lock sync(*this); if(!_session) { - throw NodeUnreachableException(_name, "node is not registered"); + throw NodeUnreachableException(_name, "the node is not active"); } return _session->getNode(); } +NodeInfo +NodeEntry::getInfo() const +{ + Lock sync(*this); + if(!_session) + { + throw NodeUnreachableException(_name, "the node is not active"); + } + return _session->getInfo(); +} + Ice::StringSeq NodeEntry::getServers() const { @@ -160,7 +171,7 @@ NodeEntry::getLoadInfoAndLoadFactor(const string& application, float& loadFactor Lock sync(*this); if(!_session) { - throw NodeUnreachableException(_name, "node is not registered"); + throw NodeUnreachableException(_name, "the node is not active"); } map<string, NodeDescriptor>::const_iterator p = _descriptors.find(application); loadFactor = -1.0f; @@ -172,6 +183,28 @@ NodeEntry::getLoadInfoAndLoadFactor(const string& application, float& loadFactor is >> loadFactor; } } + if(loadFactor < 0.0f) + { + if(_session->getInfo().os != "Windows") + { + // + // On Unix platforms, we divide the load averages by the + // number of processors. A load of 2 on a dual processor + // machine is the same as a load of 1 on a single process + // machine. + // + loadFactor = 1.0f / _session->getInfo().nProcessors; + } + else + { + // + // On Windows, load1, load5 and load15 are the average of + // the CPU utilization (all CPUs). We don't need to divide + // by the number of CPU. + // + loadFactor = 1.0f; + } + } return _session->getLoadInfo(); } |