From 0d3dc91584ea08cf90825c4e507fd333399e522f Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Thu, 4 Apr 2024 00:44:11 +0200 Subject: [PATCH] Scheduler-test: rework `ParameterRange` tool for data visualisation Rework the existing tool to capture the measurement series into the newly integrated CSV-based data storage, allowing to turn the results into a Gnuplot-visualisation. --- src/lib/incidence-count.hpp | 10 +- src/lib/stat/data.hpp | 4 +- tests/vault/gear/scheduler-stress-test.cpp | 30 ++++-- tests/vault/gear/stress-test-rig.hpp | 77 ++++++++++----- wiki/thinkPad.ichthyo.mm | 106 +++++++++++++++++++-- 5 files changed, 178 insertions(+), 49 deletions(-) diff --git a/src/lib/incidence-count.hpp b/src/lib/incidence-count.hpp index ade788c8f..8c46cebba 100644 --- a/src/lib/incidence-count.hpp +++ b/src/lib/incidence-count.hpp @@ -188,11 +188,11 @@ namespace lib { return idx < data.size()? data[idx] : VAL{}; } - size_t cntCase (size_t id) { return access (caseCntr, id); } - size_t cntThread(size_t id) { return access (thrdCntr, id); } - double timeCase (size_t id) { return access (caseTime, id); } - double timeThread(size_t id) { return access (thrdTime, id); } - double timeAtConc(size_t id) { return access (concTime, id); } + size_t cntCase (size_t id) const { return access (caseCntr, id); } + size_t cntThread(size_t id) const { return access (thrdCntr, id); } + double timeCase (size_t id) const { return access (caseTime, id); } + double timeThread(size_t id) const { return access (thrdTime, id); } + double timeAtConc(size_t id) const { return access (concTime, id); } }; Statistic evaluate(); diff --git a/src/lib/stat/data.hpp b/src/lib/stat/data.hpp index 932d67472..c00254bb0 100644 --- a/src/lib/stat/data.hpp +++ b/src/lib/stat/data.hpp @@ -128,7 +128,7 @@ namespace stat{ */ template struct Column - : util::NonCopyable + : util::MoveOnly { string header; vector data; @@ -193,7 +193,7 @@ namespace stat{ template class DataFile : public TAB - , util::NonCopyable + , util::MoveOnly { fs::path filename_; diff --git a/tests/vault/gear/scheduler-stress-test.cpp b/tests/vault/gear/scheduler-stress-test.cpp index 52ade0f2f..206d2759d 100644 --- a/tests/vault/gear/scheduler-stress-test.cpp +++ b/tests/vault/gear/scheduler-stress-test.cpp @@ -32,6 +32,7 @@ #include "lib/time/timevalue.hpp" #include "lib/format-string.hpp" #include "lib/format-cout.hpp" +#include "lib/gnuplot-gen.hpp" #include "lib/test/diagnostic-output.hpp"//////////////////////////TODO work in distress //#include "lib/format-string.hpp" #include "lib/test/transiently.hpp" @@ -394,24 +395,33 @@ namespace test { uint CONCURRENCY = 4; bool showRuns = true; - auto testLoad(size_t nodes) + using Param = size_t; + using Table = bench::DataTable; + + auto + testLoad(Param nodes) { TestChainLoad testLoad{nodes}; -// return testLoad.seedingRule(testLoad.rule().probability(0.6).minVal(2)) -// .pruningRule(testLoad.rule().probability(0.44)) -// .weightRule(testLoad.value(1)) -// .setSeed(55); -// return testLoad.setWeight(1); return testLoad.configure_isolated_nodes(); } + + void + collectResult(Table& data, double millis, bench::IncidenceStat const& stat) + { + data.time = stat.coveredTime / 1000; + data.conc = stat.avgConcurrency; + data.jobtime = stat.activeTime/stat.activationCnt; + data.overhead = stat.timeAtConc(1) / stat.activationCnt; ////OOO not really clear if sensible + } }; auto results = StressRig::with() .perform (2,64); - -cout<<"\"len\";\"dur\""< @@ -421,6 +422,34 @@ namespace test { + using lib::stat::Column; + using lib::stat::DataFile; + using lib::stat::CSVData; + using IncidenceStat = lib::IncidenceCount::Statistic; + + template + struct DataRow + { + Column param {"test param"}; // independent variable / control parameter + Column time {"result time"}; + Column conc {"concurrency"}; + Column jobtime {"avg jobtime"}; + Column overhead{"overhead"}; + + auto allColumns() + { return std::tie(param + ,time + ,conc + ,jobtime + ,overhead + ); + } + }; + + template + using DataTable = DataFile>; + + /**************************************************//** * Specific test scheme to perform a Scheduler setup @@ -431,18 +460,17 @@ namespace test { class ParameterRange : public CONF { - using TestLoad = decltype(declval().testLoad(1)); + using Table = typename CONF::Table; + using Param = typename CONF::Param; + + using TestLoad = decltype(declval().testLoad(Param())); using TestSetup = decltype(declval().testSetup (declval())); - template - using Point = std::pair; - - template void - runTest (Point& point) + runTest (Table& data) { - PAR param = point.first; + Param param = data.param; double stressFac = 1.0; TestLoad testLoad = CONF::testLoad(param).buildTopology(); TestSetup testSetup = CONF::testSetup (testLoad) @@ -452,10 +480,9 @@ namespace test { .withSchedDepends(CONF::SCHED_DEPENDS) .withAdaptedSchedule(stressFac, CONF::CONCURRENCY) .withInstrumentation(); - double testMillis = testSetup.launch_and_wait() / 1000; + double millis = testSetup.launch_and_wait() / 1000; auto stat = testSetup.getInvocationStatistic(); - point.second = stat.coveredTime / 1000; -cout << "x="< - auto - perform (PAR lower, PAR upper) + Table + perform (Param lower, Param upper) { TRANSIENTLY(work::Config::COMPUTATION_CAPACITY) = CONF::CONCURRENCY; - PAR dist = upper - lower; + Param dist = upper - lower; uint cnt = CONF::REPETITIONS; - vector> results(cnt); - PAR minP{upper}, maxP{lower}; + vector points; + points.reserve (cnt); + Param minP{upper}, maxP{lower}; for (uint i=0; i lower) results[cnt-1].first = lower; - - for (auto& point : results) - runTest (point); + if (maxP < upper) points[cnt-2] = upper; + if (minP > lower) points[cnt-1] = lower; + Table results; + for (Param& point : points) + { + results.newRow(); + results.param = point; + runTest (results); + } return results; } }; diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 255df613c..52656ee1e 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -111374,7 +111374,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -111664,7 +111664,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -111760,7 +111760,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -111883,6 +111883,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
+
@@ -111894,7 +111895,6 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
-
@@ -111981,7 +111981,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -112386,7 +112386,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -114466,7 +114466,7 @@ std::cout << tmpl.render({"what", "World"}) << s - + @@ -114677,8 +114677,96 @@ std::cout << tmpl.render({"what", "World"}) << s - - + + + + + + + + + + + + + + + + + + + + + +

+ damit man verschiende Messungen mit dem geleichen Tool-Code machen kann +

+ +
+
+ + + + +

+ der Parameter bleibt in der Tat „offen“ — aber allzuviel kann man damit nicht anstellen, denn +

+
    +
  • + der Parameter muß numerisch (und total geordnet) sein +
  • +
  • + er muß auf double konvertierbar sein und aus double erstellbar +
  • +
  • + und die tatsächlich vorzunehmenden Messungen sind auch fix +
  • +
+ +
+
+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +