From fda34a42ca8b37e68063b0bffd21e906863325d2 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Wed, 3 Jan 2024 16:27:07 +0100 Subject: [PATCH] Scheduler-test: incorporate statistics computation adapt the code written yesterday explicitly for the test case into the new framework for performing a stress-test run. Notable difference: times converted to millisecond immediately --- tests/vault/gear/stress-test-rig.hpp | 86 ++++++++++++++++++++++++++-- wiki/thinkPad.ichthyo.mm | 30 ++++++++-- 2 files changed, 105 insertions(+), 11 deletions(-) diff --git a/tests/vault/gear/stress-test-rig.hpp b/tests/vault/gear/stress-test-rig.hpp index 1f055f829..e22c7cc46 100644 --- a/tests/vault/gear/stress-test-rig.hpp +++ b/tests/vault/gear/stress-test-rig.hpp @@ -79,7 +79,7 @@ //#include //#include #include -//#include +#include namespace vault{ @@ -136,6 +136,7 @@ namespace test { double stdDev{0}; double avgDelta{0}; double avgTime{0}; + double expTime{0}; }; /** prepare the ScheduleCtx for a specifically parametrised test series */ @@ -148,10 +149,32 @@ namespace test { /** perform a repetition of test runs and compute statistics */ Res - runProbes (TestSetup& testSetup) + runProbes (TestSetup& testSetup, double stressFac) { - UNIMPLEMENTED ("test loop and statistics computation"); - Res res{}; + auto sqr = [](auto n){ return n*n; }; + Res res; + auto& [sf,pf,sdev,avgD,avgT,expT] = res; + sf = stressFac; + expT = testSetup.getExpectedEndTime() / 1000; + std::array runTime; + for (uint i=0; i CONF::FAIL_LIMIT); + if (fail) + ++ pf; + showRun(i, delta, runTime[i], runTime[i] > avgT, fail); + } + sdev = sqrt (sdev/CONF::REPETITIONS); + showStep(res); return res; } @@ -173,6 +196,49 @@ namespace test { UNIMPLEMENTED ("invoke a library implementation of binary search"); } + _Fmt fmtRun_ {"....·%-2d: Δ=%4.1f t=%4.1f %s %s"}; // i % Δ % t % t>avg? % fail? + _Fmt fmtStep_{ "%4.2f| : ∅Δ=%4.1f±%-4.2f ∅t=%4.1f %%%3.1f -- expect:%4.1fms"}; // stress % ∅Δ % σ % ∅t % fail % t-expect + _Fmt fmtResVal_{"%9s: %5.2f%s"}; + _Fmt fmtResSDv_{"%9s= %5.2f ±%4.2f%s"}; + + void + showRun(uint i, double delta, double t, bool over, bool fail) + { + if (CONF::showRuns) + cout << fmtRun_ % i % delta % t % (over? "+":"-") % (fail? "●":"○") + << endl; + } + + void + showStep(Res& res) + { + if (CONF::showStep) + cout << fmtStep_ % res.stressFac % res.avgDelta % res.stdDev % res.avgTime % res.percentOff % res.expTime + << endl; + } + + void + showRes(Res& res) + { + if (CONF::showRes) + { + cout << fmtResVal_ % "stresFac" % res.stressFac % "" < + + + + + + + @@ -110535,7 +110542,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -110680,6 +110687,17 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+ + + + + + + + + + + @@ -110891,7 +110909,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -111051,11 +111069,11 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - + + - - + +