vt::runtime::component::Diagnostic struct

The abstract Diagnostic trait for outputting debugging state information generically across VT components.

Base classes

struct ComponentName
Pure virtual class for concrete components to override, providing an unique name for the given component.
struct ComponentReducer
Trait class for the component that composes in the unique reducer for each component.

Derived classes

struct BaseComponent
The abstract BaseComponent for VT runtime component pack.

Public types

using DiagnosticBasePtrType = std::unique_ptr<detail::DiagnosticBase>
using UpdateType = DiagnosticUpdate
using UnitType = DiagnosticUnit

Constructors, destructors, conversion operators

~Diagnostic() defaulted virtual

Public functions

void dumpState() pure virtual
void foreachDiagnostic(std::function<void(detail::DiagnosticBase*)> apply)
Apply a function to each base diagnostic in a consistent order across all nodes.
auto getDiagnosticsFootprint() -> std::size_t
Return Diagnostic's memory footprint.
void preDiagnostic() virtual
Pre-diagnostic hook; this fires before finalize but after all work is done and the system is about to shut down.

Protected functions

auto registerCounter(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) -> diagnostic::Counter
Register a new diagnostic counter with default type.
auto registerGauge(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) -> diagnostic::Gauge
Register a new diagnostic gauge with default type.
auto registerTimer(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Seconds) -> diagnostic::Timer
Register a new diagnostic timer with default type.
template<typename T>
auto registerCounterT(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) -> meter::Counter<T>
Register a new diagnostic counter.
template<typename T>
auto registerGaugeT(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) -> meter::Gauge<T>
Register a new diagnostic gauge.
template<typename T>
auto registerTimerT(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Seconds) -> meter::Timer<T>
Register a new diagnostic timer.
template<typename T>
auto registerDiagnostic(std::string const& key, std::string const& desc, DiagnosticUpdate update, DiagnosticUnit unit = DiagnosticUnit::Units, DiagnosticTypeEnum type = DiagnosticTypeEnum::PerformanceDiagnostic, T initial_value = {}) -> detail::DiagnosticValue<T>*
Register a new diagnostic.
template<typename T>
void updateDiagnostic(std::string const& key, T value)
Update the current diagnostic value for a particular key.

Function documentation

void vt::runtime::component::Diagnostic::foreachDiagnostic(std::function<void(detail::DiagnosticBase*)> apply)

Apply a function to each base diagnostic in a consistent order across all nodes.

Parameters
apply in function to apply that takes detail::DiagnosticBase

std::size_t vt::runtime::component::Diagnostic::getDiagnosticsFootprint()

Return Diagnostic's memory footprint.

Returns the footprint

void vt::runtime::component::Diagnostic::preDiagnostic() virtual

Pre-diagnostic hook; this fires before finalize but after all work is done and the system is about to shut down.

\internalThis is typically used to compute some final timings that the system might use to output time-based diagnostic metrics

diagnostic::Counter vt::runtime::component::Diagnostic::registerCounter(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) protected

Register a new diagnostic counter with default type.

Parameters
key in unique key for diagnostic, should match across nodes
desc in description of the diagnostic value
unit in the unit type for this diagnostic
Returns the counter

diagnostic::Gauge vt::runtime::component::Diagnostic::registerGauge(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) protected

Register a new diagnostic gauge with default type.

Parameters
key in unique key for diagnostic, should match across nodes
desc in description of the diagnostic value
unit in the unit type for this diagnostic
Returns the gauge

diagnostic::Timer vt::runtime::component::Diagnostic::registerTimer(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Seconds) protected

Register a new diagnostic timer with default type.

Parameters
key in unique key for diagnostic, should match across nodes
desc in description of the diagnostic value
unit in the unit type for this diagnostic
Returns the timer

template<typename T>
meter::Counter<T> vt::runtime::component::Diagnostic::registerCounterT(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) protected

Register a new diagnostic counter.

Parameters
key in unique key for diagnostic, should match across nodes
desc in description of the diagnostic value
unit in the unit type for this diagnostic
Returns the counter

template<typename T>
meter::Gauge<T> vt::runtime::component::Diagnostic::registerGaugeT(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Units) protected

Register a new diagnostic gauge.

Parameters
key in unique key for diagnostic, should match across nodes
desc in description of the diagnostic value
unit in the unit type for this diagnostic
Returns the gauge

template<typename T>
meter::Timer<T> vt::runtime::component::Diagnostic::registerTimerT(std::string const& key, std::string const& desc, DiagnosticUnit unit = DiagnosticUnit::Seconds) protected

Register a new diagnostic timer.

Parameters
key in unique key for diagnostic, should match across nodes
desc in description of the diagnostic value
unit in the unit type for this diagnostic
Returns the timer

template<typename T>
detail::DiagnosticValue<T>* vt::runtime::component::Diagnostic::registerDiagnostic(std::string const& key, std::string const& desc, DiagnosticUpdate update, DiagnosticUnit unit = DiagnosticUnit::Units, DiagnosticTypeEnum type = DiagnosticTypeEnum::PerformanceDiagnostic, T initial_value = {}) protected

Register a new diagnostic.

Parameters
key in unique key for diagnostic, should match across nodes
desc in description of the diagnostic value
update in the update operator that is applied for updateDiagnostic
unit in the unit type for this diagnostic
type in the type of diagnostic being registered
initial_value in the initial value for the diagnostic
Returns the underlying diagnostic value

template<typename T>
void vt::runtime::component::Diagnostic::updateDiagnostic(std::string const& key, T value) protected

Update the current diagnostic value for a particular key.

Parameters
key in unique key for diagnostic, should match across nodes
value in the value to apply the updater to
Returns reference to diagnostic value

\internalHow the update will be applied depends on the DiagnosticUpdate that was registered when the diagnostic was created:

DiagnosticUpdate::Sum : Accumulate up the values DiagnosticUpdate::Avg : Average the values DiagnosticUpdate::Replace : Replace the existing value with each update