Project
Loading...
Searching...
No Matches
o2::framework::DataProcessingStats Struct Reference

Helper struct to hold statistics about the data processing happening. More...

#include <DataProcessingStats.h>

Classes

struct  Command
 
struct  CommandSpec
 
struct  DefaultConfig
 
struct  MetricSpec
 
struct  UpdateInfo
 

Public Types

enum struct  Op : char {
  Nop , Set , SetIfPositive , CumulativeRate ,
  InstantaneousRate , Add , Sub , Max ,
  Min
}
 
enum struct  Kind : char {
  Int , UInt64 , Double , Rate ,
  Unknown
}
 
enum struct  Scope : char { DPL , Online }
 

Public Member Functions

 DataProcessingStats (std::function< void(int64_t &base, int64_t &offset)> getRealtimeBase, std::function< int64_t(int64_t base, int64_t offset)> getTimestamp, DefaultConfig config)
 
void registerMetric (MetricSpec const &spec)
 
void updateStats (CommandSpec cmd)
 
void processCommandQueue ()
 
void flushChangedMetrics (std::function< void(MetricSpec const &, int64_t, int64_t)> const &callback)
 
void lapseTelemetry ()
 

Public Attributes

DefaultConfig config = {}
 
std::atomic< size_t > statesSize = 0
 
std::array< Command, MAX_CMDScmds = {}
 
std::array< int64_t, MAX_METRICSmetrics = {}
 
std::array< bool, MAX_METRICSupdated = {}
 
std::array< std::string, MAX_METRICSmetricsNames = {}
 
std::array< UpdateInfo, MAX_METRICSupdateInfos = {}
 
std::array< MetricSpec, MAX_METRICSmetricSpecs = {}
 
std::array< int64_t, MAX_METRICSlastPublishedMetrics = {}
 
std::vector< intavailableMetrics
 
std::atomic< intinsertedCmds = 0
 
std::atomic< intnextCmd = 0
 
std::atomic< intpendingCmds = 0
 
int64_t lastFlushedToRemote = 0
 
int64_t lastMetrics = 0
 
std::mutex mMutex
 
std::function< void(int64_t &base, int64_t &offset)> getRealtimeBase
 
std::function< int64_t(int64_t base, int64_t offset)> getTimestamp
 
int64_t realTimeBase = 0
 
int64_t initialTimeOffset = 0
 
std::atomic< int64_t > updatedMetricsLapse = 0
 
int64_t updatedMetricsTotal = 0
 
int64_t pushedMetricsTotal = 0
 
int64_t pushedMetricsLapse = 0
 
int64_t publishedMetricsTotal = 0
 
int64_t publishedMetricsLapse = 0
 
int64_t publishingInvokedTotal = 0
 
int64_t publishingDoneTotal = 0
 

Static Public Attributes

static constexpr ServiceKind service_kind = ServiceKind::Global
 
static constexpr unsigned short MAX_METRICS = 1 << 15
 
static constexpr short MAX_CMDS = 64
 

Detailed Description

Helper struct to hold statistics about the data processing happening.

Definition at line 72 of file DataProcessingStats.h.

Member Enumeration Documentation

◆ Kind

Enumerator
Int 
UInt64 
Double 
Rate 
Unknown 

A rate metric is sent out as a float and reset to 0 after each update Use the InstantaneousRate operation to update it. Most likely you also want that the minPublishInterval is as large as the maxRefreshLatency.

Definition at line 101 of file DataProcessingStats.h.

◆ Op

Enumerator
Nop 
Set 

No operation.

SetIfPositive 

Set the value to the specified value.

CumulativeRate 

Set the value to the specified value if it is positive.

InstantaneousRate 

Update the rate of the metric given the cumulative value since last time it got published.

Add 

Update the rate of the metric given the amount since the last time.

Sub 

Add the value to the current value.

Max 

Subtract the value from the current value.

Min 

Set the value to the maximum of the current value and the specified value.

Set the value to the minimum of the current value and the specified value

Definition at line 88 of file DataProcessingStats.h.

◆ Scope

Enumerator
DPL 
Online 

Definition at line 113 of file DataProcessingStats.h.

Constructor & Destructor Documentation

◆ DataProcessingStats()

o2::framework::DataProcessingStats::DataProcessingStats ( std::function< void(int64_t &base, int64_t &offset)>  getRealtimeBase,
std::function< int64_t(int64_t base, int64_t offset)>  getTimestamp,
DefaultConfig  config 
)

Definition at line 22 of file DataProcessingStats.cxx.

Member Function Documentation

◆ flushChangedMetrics()

void o2::framework::DataProcessingStats::flushChangedMetrics ( std::function< void(MetricSpec const &, int64_t, int64_t)> const &  callback)

Definition at line 193 of file DataProcessingStats.cxx.

◆ lapseTelemetry()

void o2::framework::DataProcessingStats::lapseTelemetry ( )
inline

Definition at line 213 of file DataProcessingStats.h.

◆ processCommandQueue()

void o2::framework::DataProcessingStats::processCommandQueue ( )

This will process the queue of commands required to update the stats. It is meant to be called periodically by a single thread.

Definition at line 84 of file DataProcessingStats.cxx.

◆ registerMetric()

void o2::framework::DataProcessingStats::registerMetric ( MetricSpec const &  spec)

Definition at line 252 of file DataProcessingStats.cxx.

◆ updateStats()

void o2::framework::DataProcessingStats::updateStats ( CommandSpec  cmd)

Definition at line 32 of file DataProcessingStats.cxx.

Member Data Documentation

◆ availableMetrics

std::vector<int> o2::framework::DataProcessingStats::availableMetrics

Definition at line 191 of file DataProcessingStats.h.

◆ cmds

std::array<Command, MAX_CMDS> o2::framework::DataProcessingStats::cmds = {}

Definition at line 184 of file DataProcessingStats.h.

◆ config

DefaultConfig o2::framework::DataProcessingStats::config = {}

Definition at line 78 of file DataProcessingStats.h.

◆ getRealtimeBase

std::function<void(int64_t& base, int64_t& offset)> o2::framework::DataProcessingStats::getRealtimeBase

Definition at line 204 of file DataProcessingStats.h.

◆ getTimestamp

std::function<int64_t(int64_t base, int64_t offset)> o2::framework::DataProcessingStats::getTimestamp

Definition at line 206 of file DataProcessingStats.h.

◆ initialTimeOffset

int64_t o2::framework::DataProcessingStats::initialTimeOffset = 0

Definition at line 210 of file DataProcessingStats.h.

◆ insertedCmds

std::atomic<int> o2::framework::DataProcessingStats::insertedCmds = 0

Definition at line 193 of file DataProcessingStats.h.

◆ lastFlushedToRemote

int64_t o2::framework::DataProcessingStats::lastFlushedToRemote = 0

Definition at line 198 of file DataProcessingStats.h.

◆ lastMetrics

int64_t o2::framework::DataProcessingStats::lastMetrics = 0

Definition at line 199 of file DataProcessingStats.h.

◆ lastPublishedMetrics

std::array<int64_t, MAX_METRICS> o2::framework::DataProcessingStats::lastPublishedMetrics = {}

Definition at line 190 of file DataProcessingStats.h.

◆ MAX_CMDS

constexpr short o2::framework::DataProcessingStats::MAX_CMDS = 64
staticconstexpr

Definition at line 86 of file DataProcessingStats.h.

◆ MAX_METRICS

constexpr unsigned short o2::framework::DataProcessingStats::MAX_METRICS = 1 << 15
staticconstexpr

Definition at line 85 of file DataProcessingStats.h.

◆ metrics

std::array<int64_t, MAX_METRICS> o2::framework::DataProcessingStats::metrics = {}

Definition at line 185 of file DataProcessingStats.h.

◆ metricsNames

std::array<std::string, MAX_METRICS> o2::framework::DataProcessingStats::metricsNames = {}

Definition at line 187 of file DataProcessingStats.h.

◆ metricSpecs

std::array<MetricSpec, MAX_METRICS> o2::framework::DataProcessingStats::metricSpecs = {}

Definition at line 189 of file DataProcessingStats.h.

◆ mMutex

std::mutex o2::framework::DataProcessingStats::mMutex

Definition at line 201 of file DataProcessingStats.h.

◆ nextCmd

std::atomic<int> o2::framework::DataProcessingStats::nextCmd = 0

Definition at line 195 of file DataProcessingStats.h.

◆ pendingCmds

std::atomic<int> o2::framework::DataProcessingStats::pendingCmds = 0

Definition at line 197 of file DataProcessingStats.h.

◆ publishedMetricsLapse

int64_t o2::framework::DataProcessingStats::publishedMetricsLapse = 0

Definition at line 229 of file DataProcessingStats.h.

◆ publishedMetricsTotal

int64_t o2::framework::DataProcessingStats::publishedMetricsTotal = 0

Definition at line 228 of file DataProcessingStats.h.

◆ publishingDoneTotal

int64_t o2::framework::DataProcessingStats::publishingDoneTotal = 0

Definition at line 231 of file DataProcessingStats.h.

◆ publishingInvokedTotal

int64_t o2::framework::DataProcessingStats::publishingInvokedTotal = 0

Definition at line 230 of file DataProcessingStats.h.

◆ pushedMetricsLapse

int64_t o2::framework::DataProcessingStats::pushedMetricsLapse = 0

Definition at line 227 of file DataProcessingStats.h.

◆ pushedMetricsTotal

int64_t o2::framework::DataProcessingStats::pushedMetricsTotal = 0

Definition at line 226 of file DataProcessingStats.h.

◆ realTimeBase

int64_t o2::framework::DataProcessingStats::realTimeBase = 0

Definition at line 208 of file DataProcessingStats.h.

◆ service_kind

constexpr ServiceKind o2::framework::DataProcessingStats::service_kind = ServiceKind::Global
staticconstexpr

Definition at line 84 of file DataProcessingStats.h.

◆ statesSize

std::atomic<size_t> o2::framework::DataProcessingStats::statesSize = 0

Definition at line 182 of file DataProcessingStats.h.

◆ updated

std::array<bool, MAX_METRICS> o2::framework::DataProcessingStats::updated = {}

Definition at line 186 of file DataProcessingStats.h.

◆ updatedMetricsLapse

std::atomic<int64_t> o2::framework::DataProcessingStats::updatedMetricsLapse = 0

Definition at line 224 of file DataProcessingStats.h.

◆ updatedMetricsTotal

int64_t o2::framework::DataProcessingStats::updatedMetricsTotal = 0

Definition at line 225 of file DataProcessingStats.h.

◆ updateInfos

std::array<UpdateInfo, MAX_METRICS> o2::framework::DataProcessingStats::updateInfos = {}

Definition at line 188 of file DataProcessingStats.h.


The documentation for this struct was generated from the following files: