diff options
Diffstat (limited to 'cpp/src/IceGrid/PlatformInfo.cpp')
-rw-r--r-- | cpp/src/IceGrid/PlatformInfo.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/cpp/src/IceGrid/PlatformInfo.cpp b/cpp/src/IceGrid/PlatformInfo.cpp index fc7e421159d..661de383582 100644 --- a/cpp/src/IceGrid/PlatformInfo.cpp +++ b/cpp/src/IceGrid/PlatformInfo.cpp @@ -216,33 +216,23 @@ PlatformInfo::PlatformInfo(const string& prefix, #endif // - // Get the number of processors. + // Get the number of cores/threads. E.g. a quad-core CPU with 2 threads per core will return 8. // #if defined(_WIN32) SYSTEM_INFO sysInfo; GetSystemInfo(&sysInfo); - _nProcessors = sysInfo.dwNumberOfProcessors; -#elif defined(__APPLE__) || defined(__FreeBSD__) + _nProcessorThreads = sysInfo.dwNumberOfProcessors; +#elif defined(__FreeBSD__) static int ncpu[2] = { CTL_HW, HW_NCPU }; - size_t sz = sizeof(_nProcessors); - if(sysctl(ncpu, 2, &_nProcessors, &sz, 0, 0) == -1) + size_t sz = sizeof(_nProcessorThreads); + if(sysctl(ncpu, 2, &_nProcessorThreads, &sz, 0, 0) == -1) { Ice::SyscallException ex(__FILE__, __LINE__); ex.error = IceInternal::getSystemErrno(); throw ex; } -#elif defined(__hpux) - struct pst_dynamic dynInfo; - if(pstat_getdynamic(&dynInfo, sizeof(dynInfo), 1, 0) >= 0) - { - _nProcessors = dynInfo.psd_proc_cnt; - } - else - { - _nProcessors = 1; - } #else - _nProcessors = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); + _nProcessorThreads = static_cast<int>(sysconf(_SC_NPROCESSORS_ONLN)); #endif // @@ -313,7 +303,8 @@ PlatformInfo::PlatformInfo(const string& prefix, } _nProcessorSockets = ids.size(); #else - // Not supported. + // Not supported + _nProcessorSockets = 1; #endif } @@ -415,7 +406,7 @@ PlatformInfo::getInternalNodeInfo() const info->release = _release; info->version = _version; info->machine = _machine; - info->nProcessors = _nProcessors; + info->nProcessors = _nProcessorThreads; info->dataDir = _dataDir; return info; } |