From 1f11b29ff6921ff70d502e2c031e575b841b12ee Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 1 Mar 2023 14:23:42 +0000 Subject: default_system_time => system_time_epoch --- metrics/src/vespa/metrics/metricsnapshot.cpp | 15 +++++++++------ metrics/src/vespa/metrics/metricsnapshot.h | 6 ------ 2 files changed, 9 insertions(+), 12 deletions(-) (limited to 'metrics') diff --git a/metrics/src/vespa/metrics/metricsnapshot.cpp b/metrics/src/vespa/metrics/metricsnapshot.cpp index 960abcefa52..d8c87ce52d9 100644 --- a/metrics/src/vespa/metrics/metricsnapshot.cpp +++ b/metrics/src/vespa/metrics/metricsnapshot.cpp @@ -8,13 +8,16 @@ LOG_SETUP(".metrics.snapshot"); using vespalib::to_string; + namespace metrics { +static constexpr system_time system_time_epoch = system_time(); + MetricSnapshot::MetricSnapshot(const Metric::String& name) : _name(name), _period(0), - _fromTime(default_system_time), - _toTime(default_system_time), + _fromTime(system_time_epoch), + _toTime(system_time_epoch), _snapshot(new MetricSet("top", {}, "", nullptr)), _metrics() { @@ -23,8 +26,8 @@ MetricSnapshot::MetricSnapshot(const Metric::String& name) MetricSnapshot::MetricSnapshot(const Metric::String& name, uint32_t period, const MetricSet& source, bool copyUnset) : _name(name), _period(period), - _fromTime(default_system_time), - _toTime(default_system_time), + _fromTime(system_time_epoch), + _toTime(system_time_epoch), _snapshot(), _metrics() { @@ -38,13 +41,13 @@ MetricSnapshot::~MetricSnapshot() = default; void MetricSnapshot::reset() { - reset(default_system_time); + reset(system_time_epoch); } void MetricSnapshot::reset(system_time currentTime) { _fromTime = currentTime; - _toTime = default_system_time; + _toTime = system_time_epoch; _snapshot->reset(); } diff --git a/metrics/src/vespa/metrics/metricsnapshot.h b/metrics/src/vespa/metrics/metricsnapshot.h index a4193eab6ea..16b46760957 100644 --- a/metrics/src/vespa/metrics/metricsnapshot.h +++ b/metrics/src/vespa/metrics/metricsnapshot.h @@ -16,7 +16,6 @@ namespace metrics { using system_time = vespalib::system_time; -static constexpr system_time default_system_time = system_time(); class MetricManager; @@ -61,11 +60,6 @@ public: uint32_t getPeriod() const { return _period; } system_time getFromTime() const { return _fromTime; } system_time getToTime() const { return _toTime; } - time_t getLength() const { - return (_toTime != default_system_time) - ? vespalib::count_s(_toTime - _fromTime) - : vespalib::count_s((_fromTime + vespalib::from_s(_period)).time_since_epoch()); - } const MetricSet& getMetrics() const { return *_snapshot; } MetricSet& getMetrics() { return *_snapshot; } void reset(system_time currentTime); -- cgit v1.2.3