Class for relative wall-clock time.
class tick_count::interval_t;
#include "tbb/tick_count.h"
A tick_count::interval_t represents relative wall clock duration.
namespace tbb {
class tick_count::interval_t {
public:
interval_t();
explicit interval_t( double sec );
double seconds() const;
interval_t operator+=( const interval_t& i );
interval_t operator-=( const interval_t& i );
};
tick_count::interval_t operator+(
const tick_count::interval_t& i,
const tick_count::interval_t& j );
tick_count::interval_t operator-(
const tick_count::interval_t& i,
const tick_count::interval_t& j );
} // namespace tbb
| Member | Description |
|---|---|
| interval_t() |
Constructs interval_t representing zero time duration. |
| interval_t( double sec ) |
Constructs interval_t representing specified number of seconds. |
| double seconds() const |
Returns: Time interval measured in seconds. |
| interval_t operator+=( const interval_t& i ) |
*this = *this + i Returns: Reference to *this. |
| interval_t operator-=( const interval_t& i ) |
*this = *this - i Returns: Reference to *this. |
| interval_t operator+ ( const interval_t& i, const interval_t& j ) |
Returns: Interval_t representing sum of intervals i and j. |
| interval_t operator- ( const interval_t& i, const interval_t& j ) |
Returns Interval_t representing difference of intervals i and j. |
On Microsoft Windows* operating systems, the current implementation of tick_count::seconds() uses the function QueryPerformanceFrequency. Repeated calls to tick_count::seconds() result in multiple calls to QueryPerformanceFrequency, which can be inefficient. In tight loops accumulated time should be stored as tick_count::interval_t values, with conversion to tick_count::seconds() performed outside measured code.