Lumiera  0.pre.03
»edit your freedom«
incidence-count.hpp File Reference

Go to the source code of this file.

Description

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.

Usage and limitations

This helper is intended for tests and one-time usage. Create an instance, launch a test, retrieve the observed statistics, destroy the object. Each separate Threads encountered gets the next consecutive ID. Thus it is not possible to have long-living instances or even multiple instances of IncidenceCount; doing so would require a much more elaborate ID management, which is beyond requirement's scope.

See also
IncidenceCount_test
vault::gear::TestChainLoad::ScheduleCtx
SchedulerStress_test

Definition in file incidence-count.hpp.

#include "lib/nocopy.hpp"
#include "lib/iter-explorer.hpp"
#include <cstdint>
#include <atomic>
#include <vector>
#include <chrono>
#include <limits>
#include <algorithm>

Classes

struct  IncidenceCount::Inc
 
class  IncidenceCount
 A recorder for concurrent incidences. More...
 
struct  IncidenceCount::Statistic
 

Namespaces

 lib
 Implementation namespace for support and library code.
 

Class Documentation

◆ lib::IncidenceCount::Inc

struct lib::IncidenceCount::Inc
Class Members
Instance when
uint8_t thread:8
uint8_t caseID:8
bool isLeave:1
+ Collaboration diagram for IncidenceCount::Inc: