diff options
Diffstat (limited to 'staging_vespalib')
5 files changed, 17 insertions, 17 deletions
diff --git a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp index a9e1499f014..db468044e48 100644 --- a/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp +++ b/staging_vespalib/src/tests/array/allocinarray_benchmark.cpp @@ -111,7 +111,7 @@ Test::Main() count = strtol(_argv[2], NULL, 0); } TEST_INIT("allocinarray_benchmark"); - fastos::SteadyTimeStamp start(fastos::ClockSteady::now()); + steady_time start(steady_clock::now()); if (type == "direct") { benchmarkTree(count); } else { diff --git a/staging_vespalib/src/tests/array/sort_benchmark.cpp b/staging_vespalib/src/tests/array/sort_benchmark.cpp index 03a99aa044f..3fd900503c4 100644 --- a/staging_vespalib/src/tests/array/sort_benchmark.cpp +++ b/staging_vespalib/src/tests/array/sort_benchmark.cpp @@ -100,7 +100,7 @@ Test::Main() payLoad = strtol(_argv[3], NULL, 0); } TEST_INIT("sort_benchmark"); - fastos::SteadyTimeStamp start(fastos::ClockSteady::now()); + steady_time start(steady_clock::now()); if (payLoad < 8) { typedef TT<8> T; if (type == "sortdirect") { diff --git a/staging_vespalib/src/tests/rusage/rusage_test.cpp b/staging_vespalib/src/tests/rusage/rusage_test.cpp index 23b9d4072b1..942140086d6 100644 --- a/staging_vespalib/src/tests/rusage/rusage_test.cpp +++ b/staging_vespalib/src/tests/rusage/rusage_test.cpp @@ -30,12 +30,12 @@ Test::testRUsage() RUsage diff = r2-r1; EXPECT_EQUAL(diff.toString(), r2.toString()); { - RUsage then = RUsage::createSelf(fastos::SteadyTimeStamp(7)); + RUsage then = RUsage::createSelf(steady_time(duration(7))); RUsage now = RUsage::createSelf(); EXPECT_NOT_EQUAL(now.toString(), then.toString()); } { - RUsage then = RUsage::createChildren(fastos::SteadyTimeStamp(1337583)); + RUsage then = RUsage::createChildren(steady_time(duration(1337583))); RUsage now = RUsage::createChildren(); EXPECT_NOT_EQUAL(now.toString(), then.toString()); } diff --git a/staging_vespalib/src/vespa/vespalib/util/rusage.cpp b/staging_vespalib/src/vespa/vespalib/util/rusage.cpp index 32f76775586..d5910148c79 100644 --- a/staging_vespalib/src/vespa/vespalib/util/rusage.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/rusage.cpp @@ -33,20 +33,20 @@ RUsage::RUsage() : RUsage RUsage::createSelf() { - return createSelf(fastos::SteadyTimeStamp()); + return createSelf(vespalib::steady_time()); } RUsage RUsage::createChildren() { - return createChildren(fastos::SteadyTimeStamp()); + return createChildren(vespalib::steady_time()); } RUsage -RUsage::createSelf(fastos::SteadyTimeStamp since) +RUsage::createSelf(vespalib::steady_time since) { RUsage r; - r._time = fastos::ClockSteady::now() - since; + r._time = vespalib::steady_clock::now() - since; if (getrusage(RUSAGE_SELF, &r) != 0) { throw std::runtime_error(vespalib::make_string("getrusage failed with errno = %d", errno).c_str()); } @@ -54,10 +54,10 @@ RUsage::createSelf(fastos::SteadyTimeStamp since) } RUsage -RUsage::createChildren(fastos::SteadyTimeStamp since) +RUsage::createChildren(vespalib::steady_time since) { RUsage r; - r._time = fastos::ClockSteady::now() - since; + r._time = vespalib::steady_clock::now() - since; if (getrusage(RUSAGE_CHILDREN, &r) != 0) { throw std::runtime_error(vespalib::make_string("getrusage failed with errno = %d", errno).c_str()); } @@ -68,9 +68,9 @@ vespalib::string RUsage::toString() { vespalib::string s; - if (_time.sec() != 0.0) s += make_string("duration = %1.6f\n", _time.sec()); - if (fastos::TimeStamp(ru_utime).sec() != 0.0) s += make_string("user time = %1.6f\n", fastos::TimeStamp(ru_utime).sec()); - if (fastos::TimeStamp(ru_stime).sec() != 0.0) s += make_string("system time = %1.6f\n", fastos::TimeStamp(ru_stime).sec()); + if (_time != duration::zero()) s += make_string("duration = %1.6f\n", vespalib::to_s(_time)); + if (from_timeval(ru_utime) > duration::zero()) s += make_string("user time = %1.6f\n", to_s(from_timeval(ru_utime))); + if (from_timeval(ru_stime) > duration::zero()) s += make_string("system time = %1.6f\n", to_s(from_timeval(ru_stime))); if (ru_maxrss != 0) s += make_string("ru_maxrss = %ld\n", ru_maxrss); if (ru_ixrss != 0) s += make_string("ru_ixrss = %ld\n", ru_ixrss); if (ru_idrss != 0) s += make_string("ru_idrss = %ld\n", ru_idrss); diff --git a/staging_vespalib/src/vespa/vespalib/util/rusage.h b/staging_vespalib/src/vespa/vespalib/util/rusage.h index 381d4d764e7..f2cea3ba0ab 100644 --- a/staging_vespalib/src/vespa/vespalib/util/rusage.h +++ b/staging_vespalib/src/vespa/vespalib/util/rusage.h @@ -2,7 +2,7 @@ #pragma once #include <vespa/vespalib/stllike/string.h> -#include <vespa/fastos/timestamp.h> +#include <vespa/vespalib/util/time.h> #include <sys/resource.h> namespace vespalib { @@ -17,19 +17,19 @@ public: * Will create an RUsage and initialize member with RUSAGE_SELF **/ static RUsage createSelf(); - static RUsage createSelf(fastos::SteadyTimeStamp since); + static RUsage createSelf(vespalib::steady_time since); /** * Will create an RUsage and initialize member with RUSAGE_CHILDREN **/ static RUsage createChildren(); - static RUsage createChildren(fastos::SteadyTimeStamp since); + static RUsage createChildren(vespalib::steady_time since); /** * Will create an RUsage and initialize member with RUSAGE_CHILDREN **/ vespalib::string toString(); RUsage & operator -= (const RUsage & rhs); private: - fastos::TimeStamp _time; + vespalib::duration _time; }; RUsage operator -(const RUsage & a, const RUsage & b); |