diff options
Diffstat (limited to 'metrics/src')
-rw-r--r-- | metrics/src/tests/metricmanagertest.cpp | 15 | ||||
-rw-r--r-- | metrics/src/tests/snapshottest.cpp | 3 | ||||
-rw-r--r-- | metrics/src/tests/stresstest.cpp | 3 | ||||
-rw-r--r-- | metrics/src/vespa/metrics/memoryconsumption.cpp | 9 |
4 files changed, 17 insertions, 13 deletions
diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp index 6ebea283e93..a16a470edd7 100644 --- a/metrics/src/tests/metricmanagertest.cpp +++ b/metrics/src/tests/metricmanagertest.cpp @@ -9,6 +9,7 @@ #include <vespa/vespalib/data/slime/slime.h> #include <vespa/vespalib/gtest/gtest.h> #include <vespa/vespalib/stllike/asciistream.h> +#include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/xmlstream.h> #include <vespa/vespalib/util/time.h> #include <vespa/vespalib/data/simple_buffer.h> @@ -146,7 +147,7 @@ namespace { std::pair<std::string, std::string> getMatchedMetrics(const vespalib::string& config) { - FastOS_ThreadPool pool(256 * 1024); + FastOS_ThreadPool pool(256_Ki); TestMetricSet mySet; MetricManager mm; mm.registerMetric(mm.getMetricLock(), mySet.set); @@ -465,7 +466,7 @@ std::string dumpAllSnapshots(const MetricManager& mm, TEST_F(MetricManagerTest, test_snapshots) { - FastOS_ThreadPool pool(256 * 1024); + FastOS_ThreadPool pool(256_Ki); FakeTimer* timer = new FakeTimer(1000); std::unique_ptr<MetricManager::Timer> timerImpl(timer); TestMetricSet mySet; @@ -567,7 +568,7 @@ TEST_F(MetricManagerTest, test_snapshots) TEST_F(MetricManagerTest, test_xml_output) { - FastOS_ThreadPool pool(256 * 1024); + FastOS_ThreadPool pool(256_Ki); FakeTimer* timer = new FakeTimer(1000); std::unique_ptr<MetricManager::Timer> timerImpl(timer); MetricManager mm(std::move(timerImpl)); @@ -645,7 +646,7 @@ TEST_F(MetricManagerTest, test_xml_output) TEST_F(MetricManagerTest, test_json_output) { - FastOS_ThreadPool pool(256 * 1024); + FastOS_ThreadPool pool(256_Ki); FakeTimer* timer = new FakeTimer(1000); std::unique_ptr<MetricManager::Timer> timerImpl(timer); MetricManager mm(std::move(timerImpl)); @@ -734,7 +735,7 @@ namespace { struct MetricSnapshotTestFixture { - static const size_t DEFAULT_THREAD_STACK_SIZE = 256 * 1024; + static const size_t DEFAULT_THREAD_STACK_SIZE = 256_Ki; MetricManagerTest& test; FastOS_ThreadPool pool; @@ -974,7 +975,7 @@ TEST_F(MetricManagerTest, json_output_can_have_multiple_sets_with_same_name) TEST_F(MetricManagerTest, test_text_output) { - FastOS_ThreadPool pool(256 * 1024); + FastOS_ThreadPool pool(256_Ki); FakeTimer* timer = new FakeTimer(1000); std::unique_ptr<MetricManager::Timer> timerImpl(timer); MetricManager mm(std::move(timerImpl)); @@ -1063,7 +1064,7 @@ namespace { TEST_F(MetricManagerTest, test_update_hooks) { std::ostringstream output; - FastOS_ThreadPool pool(256 * 1024); + FastOS_ThreadPool pool(256_Ki); FakeTimer* timer = new FakeTimer(1000); std::unique_ptr<MetricManager::Timer> timerImpl(timer); // Add a metric set just so one exist diff --git a/metrics/src/tests/snapshottest.cpp b/metrics/src/tests/snapshottest.cpp index 21e33a1d937..9fb5023f019 100644 --- a/metrics/src/tests/snapshottest.cpp +++ b/metrics/src/tests/snapshottest.cpp @@ -4,6 +4,7 @@ #include <vespa/metrics/metrics.h> #include <vespa/metrics/summetric.hpp> #include <vespa/vespalib/gtest/gtest.h> +#include <vespa/vespalib/util/size_literals.h> namespace metrics { @@ -175,7 +176,7 @@ TEST_F(SnapshotTest, test_snapshot_two_days) TestMetricSet set("test"); FakeTimer* timer; - FastOS_ThreadPool threadPool(256 * 1024); + FastOS_ThreadPool threadPool(256_Ki); MetricManager mm( std::unique_ptr<MetricManager::Timer>(timer = new FakeTimer)); { diff --git a/metrics/src/tests/stresstest.cpp b/metrics/src/tests/stresstest.cpp index df6641c9798..29bb66ad546 100644 --- a/metrics/src/tests/stresstest.cpp +++ b/metrics/src/tests/stresstest.cpp @@ -4,6 +4,7 @@ #include <vespa/metrics/metrics.h> #include <vespa/metrics/summetric.hpp> #include <vespa/vespalib/util/time.h> +#include <vespa/vespalib/util/size_literals.h> #include <thread> #include <vespa/vespalib/gtest/gtest.h> @@ -113,7 +114,7 @@ TEST(StressTest, test_stress) OuterMetricSet metrics; LOG(info, "Starting load givers"); - FastOS_ThreadPool threadPool(256 * 1024); + FastOS_ThreadPool threadPool(256_Ki); std::vector<Hammer::UP> hammers; for (uint32_t i=0; i<10; ++i) { hammers.push_back(std::make_unique<Hammer>(metrics, threadPool)); diff --git a/metrics/src/vespa/metrics/memoryconsumption.cpp b/metrics/src/vespa/metrics/memoryconsumption.cpp index 0391e496ecd..7b40e8127b8 100644 --- a/metrics/src/vespa/metrics/memoryconsumption.cpp +++ b/metrics/src/vespa/metrics/memoryconsumption.cpp @@ -1,6 +1,7 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "memoryconsumption.h" #include <vespa/vespalib/stllike/hash_set.hpp> +#include <vespa/vespalib/util/size_literals.h> #include <sstream> namespace metrics { @@ -125,12 +126,12 @@ MemoryConsumption::print(std::ostream& out, bool verbose, std::string MemoryConsumption::bval(uint32_t bytes) { std::ostringstream ost; - if (bytes < 10 * 1024) { + if (bytes < 10_Ki) { ost << bytes << " B"; - } else if (bytes < 10 * 1024 * 1024) { - ost << (bytes / 1024) << " kB"; + } else if (bytes < 10_Mi) { + ost << (bytes / 1_Ki) << " kB"; } else { - ost << (bytes / (1024 * 1024)) << " MB"; + ost << (bytes / 1_Mi) << " MB"; } return ost.str(); } |