tbb::tick_count::interval_t Class Reference

Relative time interval. More...

`#include <tick_count.h>`

Collaboration diagram for tbb::tick_count::interval_t:

## Public Member Functions

| interval_t ()
| Construct a time interval representing zero time duration. More...
| interval_t (double sec)
| Construct a time interval representing sec seconds time duration. More...
double | seconds () const
| Return the length of a time interval in seconds. More...
interval_t & | operator+= (const interval_t &i)
| Accumulation operator. More...
interval_t & | operator-= (const interval_t &i)
| Subtraction operator. More...

## Private Member Functions

| interval_t (long long value_)

## Static Private Member Functions

static long long | ticks_per_second ()

## Private Attributes

long long | value

## Friends

class | tbb::tick_count
interval_t | operator- (const tick_count &t1, const tick_count &t0)
| Extract the intervals from the tick_counts and subtract them. More...
interval_t | operator+ (const interval_t &i, const interval_t &j)
| Add two intervals. More...
interval_t | operator- (const interval_t &i, const interval_t &j)
| Subtract two intervals. More...

## Detailed Description

Relative time interval.

Definition at line 37 of file tick_count.h.

## Constructor & Destructor Documentation

## interval_t() [1/3]

tbb::tick_count::interval_t::interval_t | ( | long long | value_ | ) |

inline explicit private

Definition at line 39 of file tick_count.h.

: value(value_) {}

## interval_t() [2/3]

tbb::tick_count::interval_t::interval_t | ( |  | ) |

inline

Construct a time interval representing zero time duration.

Definition at line 42 of file tick_count.h.

: value(0) {};

## interval_t() [3/3]

tbb::tick_count::interval_t::interval_t | ( | double | sec | ) |

inline explicit

Construct a time interval representing sec seconds time duration.

Definition at line 122 of file tick_count.h.

{
value = static_cast<long long>(sec*interval_t::ticks_per_second());
}

References ticks_per_second(), and value.

Here is the call graph for this function:

## Member Function Documentation

## operator+=()

interval_t& tbb::tick_count::interval_t::operator+= | ( | const interval_t & | i | ) |

inline

Accumulation operator.

Definition at line 66 of file tick_count.h.

{value += i.value; return *this;}

References value.

## operator-=()

interval_t& tbb::tick_count::interval_t::operator-= | ( | const interval_t & | i | ) |

inline

Subtraction operator.

Definition at line 69 of file tick_count.h.

{value -= i.value; return *this;}

References value.

## seconds()

double tbb::tick_count::interval_t::seconds | ( |  | ) | const

inline

Return the length of a time interval in seconds.

Definition at line 130 of file tick_count.h.

{
return value*tick_count::resolution();
}

References tbb::tick_count::resolution(), and value.

Referenced by tbb::internal::thread_sleep_v3().

Here is the call graph for this function:
Here is the caller graph for this function:

## ticks_per_second()

static long long tbb::tick_count::interval_t::ticks_per_second | ( |  | ) |

inline static private

Definition at line 71 of file tick_count.h.

{
#if _WIN32||_WIN64
LARGE_INTEGER qpfreq;
int rval = QueryPerformanceFrequency(&qpfreq);
__TBB_ASSERT_EX(rval, "QueryPerformanceFrequency returned zero");
return static_cast<long long>(qpfreq.QuadPart);
#elif __linux__
return static_cast<long long>(1E9);
#else /* generic Unix */
return static_cast<long long>(1E6);
#endif /* (choice of OS) */
}

References __TBB_ASSERT_EX.

Referenced by interval_t(), and tbb::tick_count::resolution().

Here is the caller graph for this function:

## Friends And Related Function Documentation

## operator+

interval_t operator+ | ( | const interval_t & | i,
|  | const interval_t & | j
| ) |  |

friend

Add two intervals.

Definition at line 56 of file tick_count.h.

{
return interval_t(i.value+j.value);
}

## operator- [1/2]

interval_t operator- | ( | const interval_t & | i,
|  | const interval_t & | j
| ) |  |

friend

Subtract two intervals.

Definition at line 61 of file tick_count.h.

{
return interval_t(i.value-j.value);
}

## operator- [2/2]

interval_t operator- | ( | const tick_count & | t1,
|  | const tick_count & | t0
| ) |  |

friend

Extract the intervals from the tick_counts and subtract them.

Definition at line 126 of file tick_count.h.

{
return tick_count::interval_t( t1.my_count-t0.my_count );
}

## tbb::tick_count

friend class tbb::tick_count

friend

Definition at line 50 of file tick_count.h.

## Member Data Documentation

## value

long long tbb::tick_count::interval_t::value

private

Definition at line 38 of file tick_count.h.

Referenced by interval_t(), operator+=(), and operator-=().

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

- tick_count.h

tbb::tick_count::interval_t::value
long long value
Definition: tick_count.h:38
tbb::tick_count::interval_t::ticks_per_second
static long long ticks_per_second()
Definition: tick_count.h:71
tbb::tick_count::resolution
static double resolution()
Return the resolution of the clock in seconds per tick.
Definition: tick_count.h:95
tbb::tick_count::interval_t::interval_t
interval_t()
Construct a time interval representing zero time duration.
Definition: tick_count.h:42
__TBB_ASSERT_EX
#define __TBB_ASSERT_EX(predicate, comment)
"Extended" version is useful to suppress warnings if a variable is only used with an assert
Definition: tbb_stddef.h:167

Copyright © 2005-2020 Intel Corporation. All Rights Reserved.

Intel, Pentium, Intel Xeon, Itanium, Intel XScale and VTune are registered trademarks or trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

* Other names and brands may be claimed as the property of others.