summaryrefslogtreecommitdiffstats
path: root/metrics
diff options
context:
space:
mode:
authorArne H Juul <arnej27959@users.noreply.github.com>2017-04-24 12:10:42 +0200
committerGitHub <noreply@github.com>2017-04-24 12:10:42 +0200
commit9ff4bdb407ed8d855a3f86a17c99906ff738177b (patch)
treefc2b050224d7dde92d57e1f9cac12c1e5aaf6b90 /metrics
parent32ae190acc9ac5081049e1c7008d1602c68cf821 (diff)
Revert "Balder/enforce override 2"
Diffstat (limited to 'metrics')
-rw-r--r--metrics/src/tests/metricmanagertest.cpp14
-rw-r--r--metrics/src/tests/metricsettest.cpp6
-rw-r--r--metrics/src/tests/snapshottest.cpp9
-rw-r--r--metrics/src/tests/stresstest.cpp4
-rw-r--r--metrics/src/tests/testrunner.cpp6
5 files changed, 24 insertions, 15 deletions
diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp
index 0ba6bdfbd2f..362cad83a66 100644
--- a/metrics/src/tests/metricmanagertest.cpp
+++ b/metrics/src/tests/metricmanagertest.cpp
@@ -9,6 +9,8 @@
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/data/slime/slime.h>
+#include <fstream>
+#include <sstream>
#include <vespa/log/log.h>
LOG_SETUP(".test.metricmanager");
@@ -141,20 +143,22 @@ struct MetricNameVisitor : public MetricVisitor {
MetricNameVisitor(bool debug_ = false) : debug(debug_) {}
- bool visitMetricSet(const MetricSet& metricSet, bool autoGenerated) override {
+ virtual bool visitMetricSet(const MetricSet& metricSet,
+ bool autoGenerated) override
+ {
if (debug) {
ost << "<" << (autoGenerated ? "*" : "")
<< metricSet.getPath() << ">\n";
}
return true;
}
- void doneVisitingMetricSet(const MetricSet& metricSet) override {
+ virtual void doneVisitingMetricSet(const MetricSet& metricSet) override {
if (debug) {
ost << "</" << metricSet.getPath() << ">\n";
}
}
- bool visitMetric(const Metric& m, bool autoGenerated) override {
+ virtual bool visitMetric(const Metric& m, bool autoGenerated) override {
ost << (autoGenerated ? "*" : "") << m.getPath() << "\n";
return true;
}
@@ -386,7 +390,7 @@ namespace {
struct FakeTimer : public MetricManager::Timer {
time_t _time;
FakeTimer(time_t startTime = 0) : _time(startTime) {}
- time_t getTime() const override { return _time; }
+ virtual time_t getTime() const override { return _time; }
};
struct BriefValuePrinter : public MetricVisitor {
@@ -395,7 +399,7 @@ namespace {
BriefValuePrinter() : count(0), ost() {}
- bool visitMetric(const Metric& metric, bool) override {
+ virtual bool visitMetric(const Metric& metric, bool) override {
if (++count > 1) ost << ",";
//ost << metric.getPath() << ":";
ost << metric.getDoubleValue("value");
diff --git a/metrics/src/tests/metricsettest.cpp b/metrics/src/tests/metricsettest.cpp
index 2b45bd049e0..176572acbd4 100644
--- a/metrics/src/tests/metricsettest.cpp
+++ b/metrics/src/tests/metricsettest.cpp
@@ -1,5 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
+#include <vespa/fastos/fastos.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/vespalib/objects/floatingpointtype.h>
#include <vespa/metrics/metrics.h>
@@ -28,7 +28,7 @@ namespace {
TestMetricVisitor(uint32_t setsToVisit_ = 100)
: ost(), setsToVisit(setsToVisit_) {}
- bool visitMetricSet(const MetricSet& set, bool autoGenerated) override {
+ virtual bool visitMetricSet(const MetricSet& set, bool autoGenerated) override {
ost << "[" << (autoGenerated ? "*" : "") << set.getName() << "]\n";
if (setsToVisit > 0) {
--setsToVisit;
@@ -36,7 +36,7 @@ namespace {
}
return false;
}
- bool visitMetric(const Metric& m, bool autoGenerated) override {
+ virtual bool visitMetric(const Metric& m, bool autoGenerated) override {
ost << (autoGenerated ? "*" : "") << m.getName() << "\n";
return true;
}
diff --git a/metrics/src/tests/snapshottest.cpp b/metrics/src/tests/snapshottest.cpp
index 5c13a0f82b6..bee3e910fb3 100644
--- a/metrics/src/tests/snapshottest.cpp
+++ b/metrics/src/tests/snapshottest.cpp
@@ -1,5 +1,6 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/fastos/fastos.h>
#include <vespa/metrics/metrics.h>
#include <vespa/metrics/loadmetric.hpp>
#include <vespa/metrics/summetric.hpp>
@@ -39,8 +40,8 @@ struct SubSubMetricSet : public MetricSet {
SubSubMetricSet(vespalib::stringref name, const LoadTypeSet& loadTypes_, MetricSet* owner = 0);
~SubSubMetricSet();
- MetricSet* clone(std::vector<Metric::UP> &ownerList, CopyType copyType,
- metrics::MetricSet* owner, bool includeUnused) const override;
+ virtual MetricSet* clone(std::vector<Metric::UP> &ownerList, CopyType copyType,
+ metrics::MetricSet* owner, bool includeUnused) const override;
void incValues();
};
@@ -190,8 +191,10 @@ TestMetricSet::incValues() {
struct FakeTimer : public MetricManager::Timer {
uint32_t _timeInSecs;
+
FakeTimer() : _timeInSecs(1) {}
- time_t getTime() const override { return _timeInSecs; }
+
+ virtual time_t getTime() const override { return _timeInSecs; }
};
} // End of anonymous namespace
diff --git a/metrics/src/tests/stresstest.cpp b/metrics/src/tests/stresstest.cpp
index 70194ecd861..5a2a736e9ba 100644
--- a/metrics/src/tests/stresstest.cpp
+++ b/metrics/src/tests/stresstest.cpp
@@ -1,5 +1,5 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
+#include <vespa/fastos/fastos.h>
#include <vespa/metrics/metrics.h>
#include <vespa/metrics/loadmetric.hpp>
#include <vespa/metrics/summetric.hpp>
@@ -108,7 +108,7 @@ OuterMetricSet::~OuterMetricSet() { }
//std::cerr << "Loadgiver thread joined\n";
}
- void run() override {
+ virtual void run() override {
uint64_t i = 0;
while (running()) {
++i;
diff --git a/metrics/src/tests/testrunner.cpp b/metrics/src/tests/testrunner.cpp
index 9bf86e3276a..5d8dc8d4c1f 100644
--- a/metrics/src/tests/testrunner.cpp
+++ b/metrics/src/tests/testrunner.cpp
@@ -1,12 +1,14 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/fastos/fastos.h>
+#include <iostream>
+#include <vespa/log/log.h>
#include <vespa/vdstestlib/cppunit/cppunittestrunner.h>
-#include <vespa/log/log.h>
LOG_SETUP("storagecppunittests");
int
-main(int argc, const char *argv[])
+main(int argc, char **argv)
{
vdstestlib::CppUnitTestRunner testRunner;
return testRunner.run(argc, argv);