From d968da989ee79e0c14ee0e9d7808dd0c223264c9 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Tue, 28 Nov 2023 02:18:38 +0100 Subject: [PATCH] Chain-Load: define data structure for graph statistics The graph will be used to generate a computational load for testing the Scheduler; thus we need to compute some statistical indicators to characterise this load. As starting point sum counts and averages will be aggregated, accounting for particular characterisation of nodes per level. --- tests/vault/gear/test-chain-load.hpp | 115 ++++++++++++++++- wiki/thinkPad.ichthyo.mm | 182 ++++++++++++++++++++++++++- 2 files changed, 290 insertions(+), 7 deletions(-) diff --git a/tests/vault/gear/test-chain-load.hpp b/tests/vault/gear/test-chain-load.hpp index bf0da4bb9..9ce35a9c1 100644 --- a/tests/vault/gear/test-chain-load.hpp +++ b/tests/vault/gear/test-chain-load.hpp @@ -98,18 +98,20 @@ #include #include #include -//#include +#include //#include +#include #include #include #include +#include namespace vault{ namespace gear { namespace test { -// using std::string; + using std::string; // using std::function; // using lib::time::TimeValue; // using lib::time::Time; @@ -138,6 +140,8 @@ namespace test { const size_t DEFAULT_SIZ = 256; } + struct Statistic; + @@ -631,5 +635,112 @@ namespace test { + + const string STAT_SEED{"seed"}; ///< seed node + const string STAT_EXIT{"exit"}; ///< exit node + const string STAT_INNR{"innr"}; ///< inner node + const string STAT_FORK{"fork"}; ///< forking node + const string STAT_JOIN{"join"}; ///< joining node + const string STAT_LINK{"link"}; ///< 1:1 linking node + const string STAT_KNOT{"knot"}; ///< knot (joins and forks) + + const std::array KEYS = {STAT_SEED,STAT_EXIT,STAT_INNR,STAT_FORK,STAT_JOIN,STAT_LINK,STAT_KNOT}; + const uint CAT = KEYS.size(); + + using VecU = std::vector; + using LevelSums = std::array; + + /** + * Distribution indicators for one kind of evaluation. + * Evaluations over the kind of node are collected per (time)level. + * This data is then counted, averaged and weighted. + */ + struct Indicator + { + VecU data{}; + uint cnt{0}; ///< global sum over all levels + double frac{0}; ///< fraction of all nodes + double pL{0}; ///< average per level + double pLW{0}; ///< average per level and level-width + double cL{0}; ///< weight centre level for this indicator + double cLW{0}; ///< weight centre level width-reduced + + void + addPoint (uint level, uint width, uint items) + { + REQUIRE (level == data.size()); + data.push_back (items); + cnt += items; + pL += items; + pLW += items / double(width); + cL += level * items; + cLW += level * items/double(width); + } + + void + closeAverages (uint nodes) + { + uint levels = data.size(); + REQUIRE (levels > 0); + frac = cnt / double(nodes); + cL /= pL; // weighted averages: normalise to weight sum + cLW /= pLW; + pL /= levels; // simple averages : normalise to number of levels + pLW /= levels; + } + }; + + /** + * Statistic data calculated for a given chain-load topology + */ + struct Staticstic + { + uint nodes{0}; + uint levels{0}; + VecU width{}; + + std::map indicators; + + explicit + Staticstic (uint lvls) + : nodes{0} + , levels{lvls} + { + reserve (levels); + } + + void + addPoint (uint levelWidth, LevelSums& particulars) + { + levels += 1; + nodes += levelWidth; + width.push_back (levelWidth); + ASSERT (levels == width.size()); + for (uint i=0; i< CAT; ++i) + indicators[KEYS[i]].addPoint (levels, levelWidth, particulars[i]); + } + + void + closeAverages() + { + for (auto& KEY : KEYS) + indicators[KEY].closeAverages (nodes); + } + + private: + void + reserve (uint levels) + { + width.reserve (levels); + for (auto& KEY : KEYS) + { + indicators[KEY] = Indicator{}; + indicators[KEY].data.reserve(levels); + } + } + }; + + + }}} // namespace vault::gear::test #endif /*VAULT_GEAR_TEST_TEST_CHAIN_LOAD_H*/ diff --git a/wiki/thinkPad.ichthyo.mm b/wiki/thinkPad.ichthyo.mm index 1747f8b0b..e90e46faa 100644 --- a/wiki/thinkPad.ichthyo.mm +++ b/wiki/thinkPad.ichthyo.mm @@ -96265,9 +96265,9 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- - - + + + @@ -98712,7 +98712,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -99412,7 +99412,7 @@ Date:   Thu Apr 20 18:53:17 2023 +0200
- + @@ -99421,10 +99421,182 @@ Date:   Thu Apr 20 18:53:17 2023 +0200

+ +
+ + + + + + + + + + +

+ Vector mit Zähldaten indiziert nach Level +

+ + +
+
+ + + + + + +

+ Gesamt-Anzahl der Forks +

+ + +
+
+ + + + + + +

+ Forks per Level ∅ +

+ + +
+
+ + + + + + +

+ Forks per Level-Width ∅ +

+ + +
+
+ + + + + + +

+ Forks Level-γ-Schwerpunkt (centre) +

+ + +
+
+ + + + + + +

+ Forks Level-Width-γ -Schwerpunkt (centre) +

+ + +
+
+ + + + + + +

+ lineare Regression der forks_pL über den Level +

+ + +
+
+ + + + + + +

+ forks moving average über den Level +

+ + +
+
+ + + + + + +

+ forks per width moving average (über den Level) +

+ + +
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +