diff options
Diffstat (limited to 'metrics/src/vespa/metrics/metricmanager.h')
-rw-r--r-- | metrics/src/vespa/metrics/metricmanager.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/metrics/src/vespa/metrics/metricmanager.h b/metrics/src/vespa/metrics/metricmanager.h index 5f35c349f7f..b1777a1d228 100644 --- a/metrics/src/vespa/metrics/metricmanager.h +++ b/metrics/src/vespa/metrics/metricmanager.h @@ -49,7 +49,6 @@ #include "valuemetric.h" #include "updatehook.h" #include <vespa/vespalib/stllike/hash_set.h> -#include <vespa/vespalib/util/document_runnable.h> #include <vespa/vespalib/util/jsonwriter.h> #include <vespa/metrics/config-metricsmanager.h> #include <vespa/config/subscription/configsubscriber.h> @@ -61,7 +60,7 @@ template class vespalib::hash_set<metrics::Metric::String>; namespace metrics { -class MetricManager : private document::Runnable +class MetricManager { public: @@ -119,10 +118,15 @@ private: LongAverageMetric _resetLatency; LongAverageMetric _snapshotLatency; LongAverageMetric _sleepTimes; + std::atomic<bool> _stop_requested; + std::thread _thread; + void request_stop() { _stop_requested.store(true, std::memory_order_relaxed); } + bool stop_requested() const { return _stop_requested.load(std::memory_order_relaxed); } + public: MetricManager(std::unique_ptr<Timer> timer = std::make_unique<Timer>()); - ~MetricManager() override; + ~MetricManager(); void stop(); @@ -194,7 +198,7 @@ public: * of consumers. readConfig() will start a config subscription. It should * not be called multiple times. */ - void init(const config::ConfigUri & uri, FastOS_ThreadPool&, bool startThread = true); + void init(const config::ConfigUri & uri, bool startThread = true); /** * Visit a given snapshot for a given consumer. (Empty consumer name means @@ -271,7 +275,7 @@ private: friend struct SnapshotTest; void configure(const MetricLockGuard & guard, std::unique_ptr<MetricsmanagerConfig> conf); - void run() override; + void run(); time_t tick(const MetricLockGuard & guard, time_t currentTime); /** * Utility function for updating periodic metrics. |