Scheduler-test: need some instrumentation helper

...to sort out the interpretation of measurement results,
the actual duration and concurrency of ComputationLoad invocations
should be recorded, allowing to draw conclusions regarding the
Scheduler's performance as opposed to further system and thread
management effects due to concurrent operation under pressure.
This commit is contained in:
Fischlurch 2024-02-12 17:53:47 +01:00
parent 54a91bcd5a
commit a68adb0364
4 changed files with 331 additions and 2 deletions

View file

@ -0,0 +1,59 @@
/*
INCIDENCE-COUNT.hpp - instrumentation helper to watch possibly multithreaded task activations
Copyright (C) Lumiera.org
2024, Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
/** @file incidence-count.hpp
** Record and evaluate concurrent activations.
** This observation and instrumentation helper is typically used to capture
** density of incidence and effective concurrency of performance critical tasks.
** The overhead per measurement call amounts to one SystemClock invocation plus
** some heap memory access, assuming that sufficient memory was pre-allocated
** prior to the actual observation phase. Moreover, on first invocation per Thread,
** a thread local ID is constructed, thereby incrementing an global atomic counter.
** Statistics evaluation is comprised of integrating and sorting the captured
** event log, followed by a summation pass.
** @see IncidenceCount_test
** @see vault::gear::TestChainLoad::ScheduleCtx
** @see SchedulerStress_test
*/
#ifndef LIB_INCIDENCE_COUNT_H
#define LIB_INCIDENCE_COUNT_H
//#include "lib/meta/function.hpp"
//#include <utility>
namespace lib {
// using std::forward;
class IncidenceCount
{
public:
};
} // namespace lib
#endif /*LIB_INCIDENCE_COUNT_H*/

View file

@ -424,6 +424,11 @@ return: 0
END
PLANNED "Instrumentation: concurrent calls" IncidenceCount_test <<END
return: 0
END
TEST "IOS restore format" IosSavepoint_test <<END
out-lit: 0x2a
out-lit: 42

View file

@ -0,0 +1,96 @@
/*
IncidenceCount(Test) - observe and evaluate concurrent activations
Copyright (C) Lumiera.org
2024, Hermann Vosseler <Ichthyostega@web.de>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of
the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *****************************************************/
/** @file incidence-count-test.cpp
** unit test \ref IncidenceCount_test
*/
#include "lib/test/run.hpp"
#include "lib/format-cout.hpp"//////////////TODO RLY?
#include "lib/incidence-count.hpp"
//#include <string>
#include <thread>
//using std::string;
using std::this_thread::sleep_for;
namespace lib {
namespace test{
/***************************************************************************//**
* @test verifies capturing and restoring of std::ostream formatting state.
* @see ios-savepoint.hpp
*/
class IncidenceCount_test
: public Test
{
void
run (Arg)
{
demonstrate_usage();
verify_incidentCount();
verify_multithreadCount();
}
/** @test TODO
* @todo WIP 2/24 🔁 define ⟶ implement
*/
void
demonstrate_usage()
{
}
/** @test TODO verify proper counting of possibly overlapping incidences
* @todo WIP 2/24 🔁 define ⟶ implement
*/
void
verify_incidentCount()
{
UNIMPLEMENTED("verify proper counting of possibly overlapping incidences");
}
/** @test TODO verify thread-safe operation under pressure
* @todo WIP 2/24 🔁 define ⟶ implement
*/
void
verify_multithreadCount()
{
UNIMPLEMENTED("verify thread-safe operation under pressure");
}
};
LAUNCHER (IncidenceCount_test, "unit common");
}} // namespace lib::test

View file

@ -110897,8 +110897,7 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
Fokus &#10233; Ziel &#10233; es geht um <b>Halten</b>&#160;&#10231; <b>Brechen</b>
</p>
</body>
</html>
</richcontent>
</html></richcontent>
<font ITALIC="true" NAME="SansSerif" SIZE="14"/>
<icon BUILTIN="yes"/>
</node>
@ -110932,6 +110931,176 @@ Date:&#160;&#160;&#160;Thu Apr 20 18:53:17 2023 +0200<br/>
</node>
<node CREATED="1707665539100" ID="ID_1559912536" MODIFIED="1707665551400" TEXT="Erkennen gravierender Defekte"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707695734022" ID="ID_726373855" MODIFIED="1707695741504" TEXT="praktische Aufgaben">
<icon BUILTIN="flag-yellow"/>
<node COLOR="#5b280f" CREATED="1707695742692" ID="ID_534550855" MODIFIED="1707753814309" TEXT="Instrumentierung in die ComputationalLoad">
<icon BUILTIN="button_cancel"/>
<node CREATED="1707695763705" ID="ID_173852025" MODIFIED="1707754003327" TEXT="Zweck: &#x2205; Abweichung unter Real-Bedingungen">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
Zwar ist die ComputationalLoad auf die jeweilige Hardware dynamisch geeicht, aber in den Einzelbeobachtungen habe ich immer ganz erhebliche Abweichungen f&#252;r Node-Aufrufe mit Load gesehen. Daher ist die Frage, wie verh&#228;lt sich die insgesamt (kumuliert, d.h. integriert) verbrachte Zeit zu der nominell geeichten Zeit? Daraus erg&#228;be sich ein Korrektur-Faktor, den man aus dem StressFac herausrechnen k&#246;nnte
</p>
</body>
</html>
</richcontent>
</node>
<node CREATED="1707696028662" ID="ID_318007219" MODIFIED="1707696045583" TEXT="Bestehende Aufruf-Struktur ist komplex">
<node CREATED="1707696078703" ID="ID_740891424" MODIFIED="1707696109200" TEXT="es l&#xe4;uft stets eine Zeitmessung mit &#x2014; auch wenn der R&#xfc;ckgabewert weggeworfen wird"/>
<node CREATED="1707696046458" ID="ID_1059195796" MODIFIED="1707696231139">
<richcontent TYPE="NODE"><html>
<head>
</head>
<body>
<p>
Untersuchung per Godbolt.org : SystemClock-Aufrufe werden <b>nicht</b>&#160;wegoptimiert
</p>
</body>
</html>
</richcontent>
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
...das ist &#252;berraschend, denn sonst wird wirklich alles wie erwartet eingedampft und es bleibt nur die eigentliche Nutzfunktion &#252;brig; der Grund ist aber leicht einzusehen: es handelt sich um einen externen Call, der Seiteneffekte haben k&#246;nnte.
</p>
</body>
</html>
</richcontent>
</node>
</node>
<node CREATED="1707753820611" ID="ID_1314209321" MODIFIED="1707753843774" TEXT="puh... das wird eine mehrstufige Entscheidungssequenz...">
<icon BUILTIN="smily_bad"/>
<icon BUILTIN="stop-sign"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707697757045" ID="ID_1084113416" MODIFIED="1707697943840" TEXT="Instrumentierung im Job &#x27fc; effektive Concurrenvcy">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1707753850583" ID="ID_974443691" MODIFIED="1707753886880" TEXT="beide Instrumentierungen kann man hier gemeinsam machen">
<icon BUILTIN="idea"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707753869910" ID="ID_467789923" MODIFIED="1707754986603" TEXT="das ist eine generische Aufgabe: ein IncidenceCount">
<icon BUILTIN="yes"/>
<node CREATED="1707753910239" ID="ID_207246442" MODIFIED="1707754952005" TEXT="Spezifikation">
<icon BUILTIN="info"/>
<node CREATED="1707753922654" ID="ID_141944428" MODIFIED="1707753933624" TEXT="direkte Me&#xdf;-Aufrufen eingehend/ausgehend"/>
<node CREATED="1707753934275" ID="ID_174167267" MODIFIED="1707754562093" TEXT="Multi-Thread-f&#xe4;hig ohne Overhead im Me&#xdf;modus">
<richcontent TYPE="NOTE"><html>
<head>
</head>
<body>
<p>
das bedeutet: jeder Thread hat seinen eigenen &#187;Slot&#171;, den er ohne jedwede Synchronisation zugreifen kann
</p>
</body>
</html>
</richcontent>
</node>
<node CREATED="1707754287446" ID="ID_1946786749" MODIFIED="1707754298871" TEXT="erlaubt einen Daten-Reset"/>
<node CREATED="1707754306402" ID="ID_1000855981" MODIFIED="1707754339123" TEXT="Datenspeicher wachstumsf&#xe4;hig aber vor-dimensionierbar"/>
<node CREATED="1707754346219" ID="ID_70463862" MODIFIED="1707754354568" TEXT="nachtr&#xe4;gliche Statistik-Berechnung">
<node CREATED="1707754377665" ID="ID_1715084685" MODIFIED="1707754382860" TEXT="kumulierte Aktiv-Zeit"/>
<node CREATED="1707754383328" ID="ID_1187136582" MODIFIED="1707754392133" TEXT="(optional) gruppierbar"/>
<node CREATED="1707754394399" ID="ID_85130376" MODIFIED="1707754441263" TEXT="&#x2205; Parallellit&#xe4;t"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754450711" ID="ID_910369325" MODIFIED="1707754945117" TEXT="Implementierung">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754455351" ID="ID_1263178646" MODIFIED="1707754598476" TEXT="Rahmen">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754460590" ID="ID_1078644826" MODIFIED="1707754601796" TEXT="Lib-Implementierung">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754467269" ID="ID_124517380" MODIFIED="1707754601796" TEXT="Unit-Test">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754482411" ID="ID_1352527465" MODIFIED="1707754601796" TEXT="Heap-allozierte Datenstruktur">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754582085" ID="ID_1743945344" MODIFIED="1707754597885" TEXT="belegen einer l&#xfc;ckenlosen eindeutigen Thread-ID">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754857153" ID="ID_259283020" MODIFIED="1707754870587" TEXT="Reset und Dimensionierung">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754606698" ID="ID_1650260006" MODIFIED="1707754614458" TEXT="Me&#xdf;-Eing&#xe4;nge">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754656571" ID="ID_1591355619" MODIFIED="1707754905108" TEXT="markEnter">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754666026" ID="ID_1253983399" MODIFIED="1707754905108" TEXT="markLeave">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754873263" ID="ID_961298794" MODIFIED="1707754887309" TEXT="Statistik-Auswertung">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754895979" ID="ID_1713684347" MODIFIED="1707754902546" TEXT="Statistik-Record">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754913201" ID="ID_177410967" MODIFIED="1707754929796" TEXT="Incident-Timeline etablieren">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754935094" ID="ID_252947705" MODIFIED="1707754941846" TEXT="Z&#xe4;hl-Durchgang">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754958979" ID="ID_284055307" MODIFIED="1707754989232" TEXT="IncidenceCount_test">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707754993819" ID="ID_1476552932" MODIFIED="1707755044792" TEXT="demonstrate_simpleUsage">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755010724" ID="ID_6728381" MODIFIED="1707755044792" TEXT="verify_incidentCount">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755017591" ID="ID_464212476" MODIFIED="1707755044792" TEXT="verify_multithreadCount">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755101530" ID="ID_219913539" MODIFIED="1707755105097" TEXT="Integration">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755106784" ID="ID_1004950823" MODIFIED="1707755153862" TEXT="neue Flag schaltbar machen">
<icon BUILTIN="flag-yellow"/>
<node CREATED="1707755159128" ID="ID_159603961" MODIFIED="1707755173776" TEXT="kann der smart-ptr selber sein">
<icon BUILTIN="idea"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755175332" ID="ID_1338000837" MODIFIED="1707755179358" TEXT="Setter">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755113190" ID="ID_320712272" MODIFIED="1707755150362" TEXT="IncidenceCount bereitstellen">
<icon BUILTIN="flag-yellow"/>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755183413" ID="ID_1998051706" MODIFIED="1707755247237" TEXT="Init">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755186021" ID="ID_1513713092" MODIFIED="1707755247238" TEXT="auto-Reset vor jedem Lauf">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755215777" ID="ID_1011450460" MODIFIED="1707755247238" TEXT="Heuristik zur Dimensionierung">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755225871" ID="ID_940749173" MODIFIED="1707755247238" TEXT="Statistik abrufen">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755248647" ID="ID_1760925660" MODIFIED="1707755268155" TEXT="Einsatz informell verifizieren">
<icon BUILTIN="flag-yellow"/>
</node>
<node BACKGROUND_COLOR="#eee5c3" COLOR="#990000" CREATED="1707755273281" ID="ID_787410697" MODIFIED="1707755280011" TEXT="geeignet Dokumentieren (Test)">
<icon BUILTIN="flag-yellow"/>
</node>
</node>
</node>
</node>
</node>
</node>
<node BACKGROUND_COLOR="#eef0c5" COLOR="#990000" CREATED="1704915305240" ID="ID_466567694" MODIFIED="1704915313937" TEXT="Untersuchung im Stress-Test-Rig">