tick_count::interval_t Class

Summary

Class for relative wall-clock time.

Syntax

class tick_count::interval_t;

Header

#include "tbb/tick_count.h"

Description

A tick_count::interval_t represents relative wall clock duration.

Members

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
                
The following table provides additional information on the members of this template class.
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.

CAUTION

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.

For more complete information about compiler optimizations, see our Optimization Notice.