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