diff --git a/src/lib/test/microbenchmark.hpp b/src/lib/test/microbenchmark.hpp index 28b904fec..d733f93d7 100644 --- a/src/lib/test/microbenchmark.hpp +++ b/src/lib/test/microbenchmark.hpp @@ -88,7 +88,7 @@ namespace test{ auto start = system_clock::now(); invokeTestLoop(); Dur duration = system_clock::now () - start; - return duration.count()/(repeatCnt); + return duration.count() / repeatCnt; }; diff --git a/src/vault/gear/scheduler.hpp b/src/vault/gear/scheduler.hpp index 10acbf42e..a861578fa 100644 --- a/src/vault/gear/scheduler.hpp +++ b/src/vault/gear/scheduler.hpp @@ -123,6 +123,12 @@ namespace gear { { } + bool + empty() const + { + return layer1_.empty(); + } + /** * */ diff --git a/tests/vault/gear/scheduler-service-test.cpp b/tests/vault/gear/scheduler-service-test.cpp index 43e3a484b..b2b89ca41 100644 --- a/tests/vault/gear/scheduler-service-test.cpp +++ b/tests/vault/gear/scheduler-service-test.cpp @@ -30,6 +30,7 @@ #include "vault/gear/scheduler.hpp" #include "lib/time/timevalue.hpp" #include "lib/format-cout.hpp" +#include "lib/test/microbenchmark.hpp" #include "lib/test/diagnostic-output.hpp"///////////////TODO //#include "lib/util.hpp" @@ -99,22 +100,51 @@ namespace test { // this test class is declared friend to get a backdoor to Scheduler internals... auto& schedCtx = Scheduler::ExecutionCtx::from(scheduler); - Time now = schedCtx.getSchedTime(); - schedCtx.post (now, &probe, schedCtx); - CHECK (activity::WAIT == scheduler.getWork()); - cout << detector.showLog()<= start + and wasClose (invoked, start); + }; + + TimeVar start = RealClock::now(); + schedCtx.post (start, &probe, schedCtx); +SHOW_EXPR(_raw(start)) +SHOW_EXPR(_raw(detector.invokeTime(probe))) + + CHECK (wasInvoked(start)); + CHECK (scheduler.empty()); + + activity::Proc res; + double delay_us; + int64_t slip_us; + + + auto pullWork = [&] { + uint REPETITIONS = 1; + delay_us = lib::test::benchmarkTime([&]{ res = scheduler.getWork(); }, REPETITIONS); + slip_us = _raw(detector.invokeTime(probe)) - _raw(start); + }; + +// start = RealClock::now(); + pullWork(); + +SHOW_EXPR(_raw(start)) +SHOW_EXPR(_raw(detector.invokeTime(probe))) +SHOW_EXPR(res); +SHOW_EXPR(delay_us) +SHOW_EXPR(slip_us) +SHOW_EXPR(wasInvoked(start)) + CHECK (activity::WAIT == res); + + cout << detector.showLog()< + + + + + + @@ -88208,6 +88214,19 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + + + @@ -88220,6 +88239,10 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + +