HART  0.2.0
High level Audio Regression and Testing
Loading...
Searching...
No Matches
TimeIt Class Reference

Helper class for measuring duration of some block of code over multiple runs. More...

#include <hart_time_it.hpp>

Public Member Functions

 TimeIt (size_t numRuns)
 Creates a new TimeIt instance.
 
template<typename ReducerType >
auto result (ReducerType &&reducer) const -> ReducerResultType< ReducerType, std::vector< double >::const_iterator >
 Get the result of the timing measurement.
 

Detailed Description

Helper class for measuring duration of some block of code over multiple runs.

Don't instantiate this class directly, it's intended to be created via HART_TIME_IT() macro

Definition at line 73 of file hart_time_it.hpp.

Constructor & Destructor Documentation

◆ TimeIt()

TimeIt ( size_t  numRuns)
inline

Creates a new TimeIt instance.

Parameters
numRunsNumber of times to run the measured block of code

Definition at line 78 of file hart_time_it.hpp.

Member Function Documentation

◆ result()

template<typename ReducerType >
auto result ( ReducerType &&  reducer) const -> ReducerResultType<ReducerType, std::vector<double>::const_iterator>
inline

Get the result of the timing measurement.

Internally, it stores a list of durations for each run. You're expected to choose what to do with this value by providing a reducer instance like hart::mean(), hart::max(). If you want to get the raw list of values, you can use hart::collect().

Parameters
reducerCallable object that accepts a pair of std::vector iterators (begin and end). You'll probably want to use one of the HART's built-in reducers, see Reducers.

Definition at line 98 of file hart_time_it.hpp.


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