summaryrefslogtreecommitdiffstats
path: root/metrics
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 14:23:42 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-03-01 14:23:42 +0000
commit1f11b29ff6921ff70d502e2c031e575b841b12ee (patch)
tree46622c571ab835c7060b7fbd21624b36e9ae7ab9 /metrics
parentfed0490b3fbaff74e46a63555dce67fe13b46331 (diff)
default_system_time => system_time_epoch
Diffstat (limited to 'metrics')
-rw-r--r--metrics/src/vespa/metrics/metricsnapshot.cpp15
-rw-r--r--metrics/src/vespa/metrics/metricsnapshot.h6
2 files changed, 9 insertions, 12 deletions
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);