Profiles the execution time of main loop tasks. More...
#include <kanzi/core/profiling/main_loop_task_profiler.hpp>
Public Types | |
typedef AbstractValueProfiler< MainLoopTaskProfilerSampleData, IntervalProfilerSampleStatistics > | BaseValueProfiler |
The typedef of the base value profiler class. More... | |
Public Types inherited from kanzi::AbstractValueProfiler< MainLoopTaskProfilerSampleData, IntervalProfilerSampleStatistics > | |
typedef MainLoopTaskProfilerSampleData | SampleDataType |
The sample data type typedef used in derived classes. More... | |
typedef IntervalProfilerSampleStatistics | AggregateProfilingDataType |
The aggregate profiling data type typedef used in derived classes. More... | |
Public Types inherited from kanzi::AbstractProfiler | |
enum | DataType { DataTypeNotDefined, DataTypeBoolean, DataTypeUint64, DataTypeFloat, DataTypeString } |
Supported profiling data field value types. More... | |
typedef variant< monostate, bool, uint64_t, float, string > | Value |
Container for profiling data field value. More... | |
Public Member Functions | |
void | addSample (MainLoopTaskProfilerSampleData sample) |
Adds a new profiling data sample to the profiler. More... | |
void | resetSampleData () |
Resets sample data. More... | |
const MainLoopTaskProfilerSampleData & | getSample (size_t index) const |
Accesses a profiling data sample stored in the sample buffer. More... | |
const IntervalProfilerSampleStatistics & | getProfilingStatistics () const |
Gets a reference to main loop task profiling statistics. More... | |
Public Member Functions inherited from kanzi::AbstractProfiler | |
virtual | ~AbstractProfiler () |
Destructor. More... | |
string_view | getName () const |
Gets the name of the profiler. More... | |
const ProfilingCategory & | getCategory () const |
Gets a reference to the profiling category assigned to the profiler. More... | |
size_t | getAggregateDataFieldCount () const |
Gets the number of aggregate data fields. More... | |
string | getAggregateDataFieldName (size_t fieldIndex) const |
Gets the name of an aggregate data field. More... | |
Value | getAggregateDataFieldValue (size_t fieldIndex) const |
Gets the value of an aggregate profiling data field. More... | |
size_t | getSampleFieldCount () const |
Gets the number of sample data fields. More... | |
string | getSampleFieldName (size_t fieldIndex) const |
Gets the name of a data sample field. More... | |
size_t | getSampleCount () const |
Gets the number of collected profiling data samples. More... | |
Value | getSampleFieldValue (size_t sampleIndex, size_t fieldIndex) const |
Gets the value of a profiling data sample field. More... | |
void | logAggregateData () const |
Logs aggregate profiling data. More... | |
void | logAllData () const |
Logs all profiling data. More... | |
Static Public Member Functions | |
static MainLoopTaskProfilerSharedPtr | create (string_view name, const ProfilingCategory &category, size_t sampleBufferSize) |
Creates a new main loop task profiler. More... | |
Static Public Member Functions inherited from kanzi::AbstractProfiler | |
static DataType | getDataType (const Value &value) |
Gets the type of the data stored in a profiling data field. More... | |
Protected Member Functions | |
MainLoopTaskProfiler (string_view name, const ProfilingCategory &category, size_t sampleBufferSize) | |
Constructor. More... | |
MainLoopTaskProfiler (const MainLoopTaskProfiler &rhs) KZ_DELETED_FUNCTION | |
Deleted copy constructor, preventing copying of the object. More... | |
MainLoopTaskProfiler & | operator= (const MainLoopTaskProfiler &rhs) KZ_DELETED_FUNCTION |
Deleted assignment operator, preventing assignment of the object. More... | |
virtual size_t | getAggregateDataFieldCountOverride () const KZ_OVERRIDE |
The override of AbstractProfiler::getAggregateDataFieldCountOverride(). More... | |
virtual string | getAggregateDataFieldNameOverride (size_t fieldIndex) const KZ_OVERRIDE |
The override of AbstractProfiler::getAggregateDataFieldNameOverride(). More... | |
virtual size_t | getSampleFieldCountOverride () const KZ_OVERRIDE |
The override of AbstractProfiler::getSampleFieldCountOverride(). More... | |
virtual string | getSampleFieldNameOverride (size_t fieldIndex) const KZ_OVERRIDE |
The override of AbstractProfiler::getSampleFieldNameOverride(). More... | |
virtual Value | getAggregateDataFieldValueOverride (size_t fieldIndex) const KZ_OVERRIDE |
The override of AbstractProfiler::getAggregateDataFieldValueOverride(). More... | |
virtual Value | getSampleFieldValueOverride (size_t sampleIndex, size_t fieldIndex) const KZ_OVERRIDE |
The override of AbstractProfiler::getSampleFieldValueOverride(). More... | |
Protected Member Functions inherited from kanzi::AbstractValueProfiler< MainLoopTaskProfilerSampleData, IntervalProfilerSampleStatistics > | |
AbstractValueProfiler (string_view name, const ProfilingCategory &category, size_t sampleBufferSize) | |
Constructor. More... | |
const MainLoopTaskProfilerSampleData & | getSample (size_t index) const |
Accesses a profiling data sample stored in the sample buffer. More... | |
void | addSample (const MainLoopTaskProfilerSampleData &sample) |
Adds a new profiling data sample. More... | |
void | addSample (KZ_RV_REF(MainLoopTaskProfilerSampleData) sample) |
Adds a new movable profiling data sample to the profiler. More... | |
void | resetSampleData () |
Resets the aggregate profiling data and sample buffer. More... | |
virtual size_t | getSampleCountOverride () const KZ_OVERRIDE |
Override of #AbstractProfiler::getSampleCountOverride(). More... | |
Protected Member Functions inherited from kanzi::AbstractProfiler | |
AbstractProfiler (string_view name, const ProfilingCategory &category) | |
Constructor. More... | |
virtual void | logAggregateDataOverride () const |
To implement your own logging of aggregate profiling data, override this function in the derived profiler class. More... | |
virtual void | logAllDataOverride () const |
To implement your own logging of all profiling data, override this function in the derived profiler class. More... | |
Additional Inherited Members | |
Protected Attributes inherited from kanzi::AbstractValueProfiler< MainLoopTaskProfilerSampleData, IntervalProfilerSampleStatistics > | |
IntervalProfilerSampleStatistics | m_aggregateProfilingData |
The aggregate profiling data. More... | |
Profiles the execution time of main loop tasks.
The main loop task profiler collects samples of type MainLoopTaskProfilerSampleData, which include information about interval duration, start point, and main loop counter identifying the main loop iteration when the interval was measured.
For details on the information included in the sample, see MainLoopTaskProfilerSampleData. For an example of how the profiling sample is collected in main loop task profiling, see MainLoopTaskProfilingSampler.
The MainLoopTaskProfilerSampleData keeps samples in a circular sample buffer. Every time a new sample is added to the profiler, the statistics data is updated. To access the statistics data, use getProfilingStatistics().
typedef AbstractValueProfiler<MainLoopTaskProfilerSampleData, IntervalProfilerSampleStatistics> kanzi::MainLoopTaskProfiler::BaseValueProfiler |
The typedef of the base value profiler class.
|
explicitprotected |
Constructor.
name | The name of the profiler. |
category | The category assigned to the profiler. |
sampleBufferSize | The maximum size of the sample buffer. |
|
explicitprotected |
Deleted copy constructor, preventing copying of the object.
|
static |
Creates a new main loop task profiler.
name | The name of the new profiler. |
category | The profiling category assigned to the profiler. |
sampleBufferSize | The maximum size of the profiling sample buffer. |
void kanzi::MainLoopTaskProfiler::addSample | ( | MainLoopTaskProfilerSampleData | sample | ) |
Adds a new profiling data sample to the profiler.
sample | The profiling data sample. |
void kanzi::MainLoopTaskProfiler::resetSampleData | ( | ) |
Resets sample data.
Clears sample buffer and resets sample statistics.
|
inline |
Accesses a profiling data sample stored in the sample buffer.
index | The index of the sample. |
|
inline |
Gets a reference to main loop task profiling statistics.
|
protected |
Deleted assignment operator, preventing assignment of the object.
|
protectedvirtual |
The override of AbstractProfiler::getAggregateDataFieldCountOverride().
Implements kanzi::AbstractProfiler.
|
protectedvirtual |
The override of AbstractProfiler::getAggregateDataFieldNameOverride().
fieldIndex | The index of the field. |
Implements kanzi::AbstractProfiler.
|
protectedvirtual |
The override of AbstractProfiler::getSampleFieldCountOverride().
Implements kanzi::AbstractProfiler.
|
protectedvirtual |
The override of AbstractProfiler::getSampleFieldNameOverride().
fieldIndex | The index of the sample field. |
Implements kanzi::AbstractProfiler.
|
protectedvirtual |
The override of AbstractProfiler::getAggregateDataFieldValueOverride().
fieldIndex | The index of the aggregate profiling data field. |
Implements kanzi::AbstractProfiler.
|
protectedvirtual |
The override of AbstractProfiler::getSampleFieldValueOverride().
sampleIndex | The index of the profiling data sample. |
fieldIndex | The index of the profiling data sample field. |
Implements kanzi::AbstractProfiler.