diff options
author | Tor Egge <Tor.Egge@yahoo-inc.com> | 2016-11-04 13:45:25 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@yahoo-inc.com> | 2016-11-04 13:45:25 +0000 |
commit | 178e58e7da6d8f8dce048065b6a9d79158875a49 (patch) | |
tree | bd6a292ccf679805174f4d944276650776c61155 /searchcore | |
parent | 28d80634f49ca5fc9d4f7df15c357ee2a9b34b87 (diff) |
Add skeleton of class that samples hardware to derive info
(e.g. check if disk is slow for sequential writes).
Diffstat (limited to 'searchcore')
5 files changed, 44 insertions, 1 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt index 2af74b40dd0..544e23b20ac 100644 --- a/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/common/CMakeLists.txt @@ -12,6 +12,7 @@ vespa_add_library(searchcore_pcommon STATIC eventlogger.cpp feeddebugger.cpp feedtoken.cpp + hw_info_sampler.cpp schemautil.cpp selectpruner.cpp selectcontext.cpp diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp new file mode 100644 index 00000000000..ca6efa347cd --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.cpp @@ -0,0 +1,13 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "hw_info_sampler.h" + +namespace proton { + +HwInfoSampler::HwInfoSampler(const vespalib::string &path) + : _hwInfo() +{ + (void) path; +} + +} diff --git a/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.h b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.h new file mode 100644 index 00000000000..32772f2d41e --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/common/hw_info_sampler.h @@ -0,0 +1,23 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "hw_info.h" +#include <vespa/vespalib/stllike/string.h> + +namespace proton { + +/* + * Class detecting some hardware characteristics on the machine, e.g. + * speed of sequential write to file. + */ +class HwInfoSampler +{ + HwInfo _hwInfo; +public: + HwInfoSampler(const vespalib::string &path); + + const HwInfo &hwInfo() const { return _hwInfo; } +}; + +} diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp index f14b4efc1d8..942d90a728f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp @@ -35,6 +35,7 @@ LOG_SETUP(".proton.server.proton"); #include <vespa/vespalib/util/closuretask.h> #include <vespa/vespalib/util/random.h> #include <vespa/searchcore/proton/common/hw_info.h> +#include <vespa/searchcore/proton/common/hw_info_sampler.h> using document::DocumentTypeRepo; using vespalib::FileHeader; @@ -210,7 +211,8 @@ Proton::Proton(const config::ConfigUri & configUri, _initStarted(false), _initComplete(false), _initDocumentDbsInSequence(false), - _hwInfo() + _hwInfo(), + _hwInfoSampler() { } @@ -239,6 +241,8 @@ Proton::init(const BootstrapConfig::SP & configSnapshot) { assert( _initStarted && ! _initComplete ); const ProtonConfig &protonConfig = configSnapshot->getProtonConfig(); + _hwInfoSampler = std::make_unique<HwInfoSampler>(protonConfig.basedir); + _hwInfo = _hwInfoSampler->hwInfo(); setFS4Compression(protonConfig); _diskMemUsageSampler = std::make_unique<DiskMemUsageSampler> (protonConfig.basedir, diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.h b/searchcore/src/vespa/searchcore/proton/server/proton.h index cf551c13748..7bf51b4a0d1 100644 --- a/searchcore/src/vespa/searchcore/proton/server/proton.h +++ b/searchcore/src/vespa/searchcore/proton/server/proton.h @@ -36,6 +36,7 @@ namespace proton { class DiskMemUsageSampler; +class HwInfoSampler; class Proton : public IBootstrapOwner, public search::engine::MonitorServer, @@ -141,6 +142,7 @@ private: bool _initComplete; bool _initDocumentDbsInSequence; HwInfo _hwInfo; + std::unique_ptr<HwInfoSampler> _hwInfoSampler; bool performDataDirectoryUpgrade(const vespalib::string &baseDir); void loadLibrary(const vespalib::string &libName); |