diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-16 23:18:41 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2019-12-16 23:18:41 +0000 |
commit | 08fb72c58d39698d15ee7e3a0b967accbaa8bd5b (patch) | |
tree | bc94ab1ced714a3e681a79b6f6ad444ec32b158e | |
parent | 3415614a539e1e923513ac941c3b9ea7d171ae95 (diff) |
Convert to double before computations.
4 files changed, 14 insertions, 30 deletions
diff --git a/searchlib/src/tests/attribute/benchmark/attributeupdater.h b/searchlib/src/tests/attribute/benchmark/attributeupdater.h index 3ed26c31ecb..28ecf72dd0a 100644 --- a/searchlib/src/tests/attribute/benchmark/attributeupdater.h +++ b/searchlib/src/tests/attribute/benchmark/attributeupdater.h @@ -70,17 +70,19 @@ public: std::cout << "<avg-value-update-time>" << avgValueUpdateTime() << "</avg-value-update-time>" << std::endl; } double documentUpdateThroughput() const { - return _numDocumentUpdates * 1000 / vespalib::count_ms(_totalUpdateTime); + return _numDocumentUpdates * 1000 / as_ms(); } double avgDocumentUpdateTime() const { - return vespalib::count_ms(_totalUpdateTime) / _numDocumentUpdates; + return as_ms() / _numDocumentUpdates; } double valueUpdateThroughput() const { - return _numValueUpdates * 1000 / vespalib::count_ms(_totalUpdateTime); + return _numValueUpdates * 1000 / as_ms(); } double avgValueUpdateTime() const { - return vespalib::count_ms(_totalUpdateTime) / _numValueUpdates; + return as_ms() / _numValueUpdates; } +private: + double as_ms() const { return vespalib::count_ms(_totalUpdateTime);} }; // AttributeVectorInstance, AttributeVectorType, AttributeVectorBufferType @@ -148,7 +150,7 @@ AttributeUpdater<Vector, T, BT>::AttributeUpdater(const AttributePtr & attrPtr, {} template <typename Vector, typename T, typename BT> -AttributeUpdater<Vector, T, BT>::~AttributeUpdater() {} +AttributeUpdater<Vector, T, BT>::~AttributeUpdater() = default; template <typename Vector, typename T, typename BT> class AttributeUpdaterThread : public AttributeUpdater<Vector, T, BT>, public Runnable @@ -173,7 +175,7 @@ AttributeUpdaterThread<Vector, T, BT>::AttributeUpdaterThread(const AttributePtr Runnable() {} template <typename Vector, typename T, typename BT> -AttributeUpdaterThread<Vector, T, BT>::~AttributeUpdaterThread() { } +AttributeUpdaterThread<Vector, T, BT>::~AttributeUpdaterThread() = default; template <typename Vector, typename T, typename BT> @@ -312,6 +314,4 @@ AttributeUpdaterThread<Vector, T, BT>::doRun() this->_status._totalUpdateTime += this->_timer.elapsed(); } - } // search - diff --git a/searchlib/src/tests/features/featurebenchmark.cpp b/searchlib/src/tests/features/featurebenchmark.cpp index 54c2e8c7033..6e1c5b1487c 100644 --- a/searchlib/src/tests/features/featurebenchmark.cpp +++ b/searchlib/src/tests/features/featurebenchmark.cpp @@ -649,7 +649,7 @@ Benchmark::Main() } std::cout << "TET: " << vespalib::count_ms(_sample) << " (ms)" << std::endl; - std::cout << "ETPD: " << std::fixed << std::setprecision(10) << vespalib::count_ms(_sample) / cfg.getNumRuns() << " (ms)" << std::endl; + std::cout << "ETPD: " << std::fixed << std::setprecision(10) << double(vespalib::count_ms(_sample)) / cfg.getNumRuns() << " (ms)" << std::endl; std::cout << "**** '" << cfg.getFeature() << "' ****" << std::endl; TEST_DONE(); diff --git a/staging_vespalib/src/tests/clock/clock_benchmark.cpp b/staging_vespalib/src/tests/clock/clock_benchmark.cpp index 1a4cb20e338..cbf7275f06e 100644 --- a/staging_vespalib/src/tests/clock/clock_benchmark.cpp +++ b/staging_vespalib/src/tests/clock/clock_benchmark.cpp @@ -123,7 +123,7 @@ void benchmark(const char * desc, FastOS_ThreadPool & pool, uint64_t samples, ui count[i] += sampler->_count[i]; } } - printf("%s: Took %ld clock samples in %2.3f with [%ld, %ld, %ld] counts\n", desc, samples, to_s(steady_clock ::now() - start), count[0], count[1], count[2]); + printf("%s: Took %ld clock samples in %2.3f with [%ld, %ld, %ld] counts\n", desc, samples, to_s(steady_clock::now() - start), count[0], count[1], count[2]); } int diff --git a/staging_vespalib/src/tests/rusage/rusage_test.cpp b/staging_vespalib/src/tests/rusage/rusage_test.cpp index 942140086d6..0f2992e09e8 100644 --- a/staging_vespalib/src/tests/rusage/rusage_test.cpp +++ b/staging_vespalib/src/tests/rusage/rusage_test.cpp @@ -5,23 +5,7 @@ using namespace vespalib; -class Test : public TestApp -{ -public: - int Main() override; - void testRUsage(); -}; - -int -Test::Main() -{ - TEST_INIT("rusage_test"); - testRUsage(); - TEST_DONE(); -} - -void -Test::testRUsage() +TEST("testRUsage") { RUsage r1; EXPECT_EQUAL("", r1.toString()); @@ -30,12 +14,12 @@ Test::testRUsage() RUsage diff = r2-r1; EXPECT_EQUAL(diff.toString(), r2.toString()); { - RUsage then = RUsage::createSelf(steady_time(duration(7))); + RUsage then = RUsage::createSelf(steady_time(7ns)); RUsage now = RUsage::createSelf(); EXPECT_NOT_EQUAL(now.toString(), then.toString()); } { - RUsage then = RUsage::createChildren(steady_time(duration(1337583))); + RUsage then = RUsage::createChildren(steady_time(1337583ns)); RUsage now = RUsage::createChildren(); EXPECT_NOT_EQUAL(now.toString(), then.toString()); } @@ -70,4 +54,4 @@ Test::testRUsage() } } -TEST_APPHOOK(Test) +TEST_MAIN() { TEST_RUN_ALL(); } |