Lumiera  0.pre.03
»edit your freedom«
IncidenceCount Class Reference

#include "lib/incidence-count.hpp"

Description

A recorder for concurrent incidences.

Start and end of individual activations are recorded by direct calls, automatically detecting the thread identity; for further differentiation, an additional caseID can be given. Accumulated observations can be integrated into a statistics evaluation.

Warning
never operate multiple instances of this helper at the same time

Definition at line 74 of file incidence-count.hpp.

Public Member Functions

double calcCumulatedTime ()
 
Statistic evaluate ()
 Visit all data captured thus far, construct an unified timeline and then compute statistics evaluations to characterise observations. More...
 
IncidenceCountexpectIncidents (size_t cnt)
 
IncidenceCountexpectThreads (uint8_t cnt)
 
void markEnter (uint8_t caseID=0)
 
void markLeave (uint8_t caseID=0)
 

Classes

struct  Inc
 
struct  Statistic
 

Private Types

using Clock = std::chrono::steady_clock
 
using Dur = std::chrono::duration< double, TIMING_SCALE >
 
using Instance = decltype(Clock::now())
 
using Recording = vector< Sequence >
 
using Sequence = vector< Inc >
 
using TIMING_SCALE = std::micro
 

Private Member Functions

void addEntry (uint8_t caseID, bool isLeave)
 
uint8_t allocateNextSlot ()
 threadsafe allocation of thread/slotID
 
Sequence & getMySequence (uint8_t threadID)
 
uint8_t getMySlot ()
 
- Private Member Functions inherited from NonCopyable
 NonCopyable (NonCopyable const &)=delete
 
NonCopyableoperator= (NonCopyable const &)=delete
 

Private Attributes

Recording rec_
 
std::atomic_uint8_t slotID_ {0}
 

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:

Member Function Documentation

◆ evaluate()

IncidenceCount::Statistic evaluate ( )
inline

Visit all data captured thus far, construct an unified timeline and then compute statistics evaluations to characterise observations.

Warning
caller must ensure there was a barrier or visibility sync before invocation.

Definition at line 216 of file incidence-count.hpp.

References IncidenceCount::Statistic::activeTime, IncidenceCount::Statistic::avgConcurrency, IncidenceCount::Statistic::caseCntr, IncidenceCount::Statistic::caseTime, IncidenceCount::Statistic::coveredTime, IncidenceCount::Statistic::cumulatedTime, lib::explore(), IncidenceCount::Statistic::thrdCntr, and IncidenceCount::Statistic::thrdTime.

+ Here is the call graph for this function:
+ Inheritance diagram for IncidenceCount:
+ Collaboration diagram for IncidenceCount:

The documentation for this class was generated from the following file: