diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-25 09:50:42 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-01-25 09:50:42 +0000 |
commit | 03b14c66e80c38288a00deed91a0b7e0f10a2b06 (patch) | |
tree | 910611c693783dd267767e402f222c37e3eb7d5a /searchcore | |
parent | 7f7dd260c32744e46473a26d1ecc0d4a15bfed6d (diff) |
You can never have 0 cores.... Then you do not exist...
Diffstat (limited to 'searchcore')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/common/hw_info.h | 5 | ||||
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp | 4 |
2 files changed, 4 insertions, 5 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info.h b/searchcore/src/vespa/searchcore/proton/common/hw_info.h index 9129aa43483..d742a300d22 100644 --- a/searchcore/src/vespa/searchcore/proton/common/hw_info.h +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info.h @@ -3,6 +3,7 @@ #pragma once #include <cstdint> +#include <algorithm> namespace proton { @@ -41,7 +42,7 @@ public: private: uint32_t _cores; public: - Cpu(uint32_t cores_) : _cores(cores_) {} + Cpu(uint32_t cores_) : _cores(std::max(1u, cores_)) { } uint32_t cores() const { return _cores; } bool operator == (const Cpu & rhs) const { return _cores == rhs._cores; } }; @@ -55,7 +56,7 @@ public: HwInfo() : _disk(0, false, false), _memory(0), - _cpu(0) + _cpu(1) { } diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp index 190e904ad68..c94a3048298 100644 --- a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp @@ -121,9 +121,7 @@ HwInfoSampler::HwInfoSampler(const vespalib::string &path, HwInfo::Cpu(sampleCpuCores(config))); } -HwInfoSampler::~HwInfoSampler() -{ -} +HwInfoSampler::~HwInfoSampler() = default; void HwInfoSampler::setup(const HwInfo::Disk &disk, const HwInfo::Memory &memory, const HwInfo::Cpu &cpu) |