Ocean
|
This class implements a simple module gathering high performance timer statistics. More...
Data Structures | |
class | ScopedStatistic |
This class defines a scoped high performance statistic module. More... | |
Public Types | |
typedef std::vector< double > | Measurements |
Definition of a vector storing performance measurements. More... | |
Public Member Functions | |
HighPerformanceStatistic () | |
Creates a new statistic module. More... | |
double | first () const |
Returns the first measurement time in seconds. More... | |
double | firstMseconds () const |
Returns the first measurement time in milliseconds. More... | |
double | second () const |
Returns the second measurement time in seconds. More... | |
double | secondMseconds () const |
Returns the second measurement time in milliseconds. More... | |
double | best () const |
Returns the best measurement time in seconds. More... | |
double | bestMseconds () const |
Returns the best measurement time in milliseconds. More... | |
double | worst () const |
Returns the worst measurement time in seconds. More... | |
double | worstMseconds () const |
Returns the worst measurement time in milliseconds. More... | |
double | last () const |
Returns the last measurement time in seconds. More... | |
double | lastMseconds () const |
Returns the last (most recent measurement time in milliseconds. More... | |
double | average () const |
Returns the average measurement time in seconds. More... | |
double | averageMseconds () const |
Returns the average measurement time in milliseconds. More... | |
double | averageCyclesPerOperation (const double operations, const double clockRate=3800000000.0) const |
Returns the average number of CPU cycles needed for one operation. More... | |
double | median () const |
Returns the median measurement time in seconds. More... | |
double | medianMseconds () const |
Returns the median measurement time in milliseconds. More... | |
double | percentile (double value) const |
Returns a specific percentile (e.g., P50 = median, P90, P95, etc.) measurement time in seconds. More... | |
double | percentileMseconds (double value) const |
Returns a specific percentile (e.g., P50 = median, P90, P95, etc.) measurement time in milliseconds. More... | |
double | total () const |
Returns the total measurement time in seconds. More... | |
double | totalMseconds () const |
Returns the total measurement time in milliseconds. More... | |
double | running () const |
Returns the current (still) running measurement time in seconds. More... | |
double | runningMseconds () const |
Returns the current (still) running measurement time in milliseconds. More... | |
size_t | measurements () const |
Returns the number of measurements. More... | |
bool | isRunning () const |
Returns whether currently a measurement is running. More... | |
void | start () |
Starts a new measurement. More... | |
void | startIf (const bool value) |
Starts a new measurement if the given value is True, otherwise nothing happens. More... | |
void | stop () |
Stops a measurement. More... | |
void | stopIf (const bool value) |
Stops a measurement. More... | |
void | skip () |
Skips a started measurement. More... | |
void | skipIf (const bool value) |
Skips a started measurement. More... | |
void | reset () |
Resets all gathered statistics. More... | |
std::string | toString (const unsigned int precision=2u) const |
Returns a string with the relevant performance information of this statistic object. More... | |
operator bool () const | |
Returns whether at least one measurement has been done. More... | |
HighPerformanceStatistic & | operator+= (const HighPerformanceStatistic &right) |
Adds measurements from another object to this statistic object. More... | |
Private Attributes | |
HighPerformanceTimer | timer_ |
High performance timer. More... | |
Measurements | measurements_ |
The individual measurements in order as measured. More... | |
double | best_ = DBL_MAX |
Best measurement time in seconds. More... | |
double | worst_ = -DBL_MAX |
Worst measurement time in seconds. More... | |
double | total_ = 0.0 |
Entire measurement time in seconds. More... | |
bool | started_ = false |
State determining whether one measurement is active currently. More... | |
This class implements a simple module gathering high performance timer statistics.
The class is not thread-safe.
typedef std::vector<double> Ocean::HighPerformanceStatistic::Measurements |
Definition of a vector storing performance measurements.
Ocean::HighPerformanceStatistic::HighPerformanceStatistic | ( | ) |
Creates a new statistic module.
double Ocean::HighPerformanceStatistic::average | ( | ) | const |
Returns the average measurement time in seconds.
|
inline |
Returns the average number of CPU cycles needed for one operation.
operations | The number of operation that has been invoked during each measurement, with range [1, infinity) |
clockRate | The number of clock cycles per second of the CPU, e.g., 3.8GHz, with range [1, infinity) |
|
inline |
Returns the average measurement time in milliseconds.
|
inline |
Returns the best measurement time in seconds.
|
inline |
Returns the best measurement time in milliseconds.
|
inline |
Returns the first measurement time in seconds.
|
inline |
Returns the first measurement time in milliseconds.
|
inline |
Returns whether currently a measurement is running.
|
inline |
Returns the last measurement time in seconds.
|
inline |
Returns the last (most recent measurement time in milliseconds.
|
inline |
Returns the number of measurements.
double Ocean::HighPerformanceStatistic::median | ( | ) | const |
Returns the median measurement time in seconds.
double Ocean::HighPerformanceStatistic::medianMseconds | ( | ) | const |
Returns the median measurement time in milliseconds.
|
inlineexplicit |
Returns whether at least one measurement has been done.
HighPerformanceStatistic& Ocean::HighPerformanceStatistic::operator+= | ( | const HighPerformanceStatistic & | right | ) |
Adds measurements from another object to this statistic object.
right | The statistic object of which the measurements will be added to this object |
double Ocean::HighPerformanceStatistic::percentile | ( | double | value | ) | const |
Returns a specific percentile (e.g., P50 = median, P90, P95, etc.) measurement time in seconds.
value | The percentile to be returned, with range [0, 1] |
double Ocean::HighPerformanceStatistic::percentileMseconds | ( | double | value | ) | const |
Returns a specific percentile (e.g., P50 = median, P90, P95, etc.) measurement time in milliseconds.
value | The percentile to be returned, with range [0, 1] |
void Ocean::HighPerformanceStatistic::reset | ( | ) |
Resets all gathered statistics.
|
inline |
Returns the current (still) running measurement time in seconds.
|
inline |
Returns the current (still) running measurement time in milliseconds.
|
inline |
Returns the second measurement time in seconds.
|
inline |
Returns the second measurement time in milliseconds.
void Ocean::HighPerformanceStatistic::skip | ( | ) |
Skips a started measurement.
The measurement will not be voted.
void Ocean::HighPerformanceStatistic::skipIf | ( | const bool | value | ) |
Skips a started measurement.
The measurement will not be voted.
value | True; to skip the measurement; False, to ignore this call |
void Ocean::HighPerformanceStatistic::start | ( | ) |
Starts a new measurement.
void Ocean::HighPerformanceStatistic::startIf | ( | const bool | value | ) |
Starts a new measurement if the given value is True, otherwise nothing happens.
value | True; to start a new measurement; False, to ignore this call |
void Ocean::HighPerformanceStatistic::stop | ( | ) |
Stops a measurement.
void Ocean::HighPerformanceStatistic::stopIf | ( | const bool | value | ) |
Stops a measurement.
value | True; to stop the measurement; False, to ignore this call |
std::string Ocean::HighPerformanceStatistic::toString | ( | const unsigned int | precision = 2u | ) | const |
Returns a string with the relevant performance information of this statistic object.
precision | The number of decimal places displayed, with range [1, infinity) |
|
inline |
Returns the total measurement time in seconds.
|
inline |
Returns the total measurement time in milliseconds.
|
inline |
Returns the worst measurement time in seconds.
|
inline |
Returns the worst measurement time in milliseconds.
|
private |
Best measurement time in seconds.
|
private |
The individual measurements in order as measured.
|
private |
State determining whether one measurement is active currently.
|
private |
High performance timer.
|
private |
Entire measurement time in seconds.
|
private |
Worst measurement time in seconds.