Home ⌂Doc Index ◂Up ▴
Intel(R) Threading Building Blocks Doxygen Documentation  version 4.2.3
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_toperator+= (const interval_t &i)
 Accumulation operator. More...
 
interval_toperator-= (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_)
inlineexplicitprivate

Definition at line 39 of file tick_count.h.

39 : 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.

42 : value(0) {};

◆ interval_t() [3/3]

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

Construct a time interval representing sec seconds time duration.

Definition at line 122 of file tick_count.h.

122  {
123  value = static_cast<long long>(sec*interval_t::ticks_per_second());
124 }
static long long ticks_per_second()
Definition: tick_count.h:71

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.

66 {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.

69 {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.

130  {
131  return value*tick_count::resolution();
132 }
static double resolution()
Return the resolution of the clock in seconds per tick.
Definition: tick_count.h:95

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 ( )
inlinestaticprivate

Definition at line 71 of file tick_count.h.

71  {
72 #if _WIN32||_WIN64
73  LARGE_INTEGER qpfreq;
74  int rval = QueryPerformanceFrequency(&qpfreq);
75  __TBB_ASSERT_EX(rval, "QueryPerformanceFrequency returned zero");
76  return static_cast<long long>(qpfreq.QuadPart);
77 #elif __linux__
78  return static_cast<long long>(1E9);
79 #else /* generic Unix */
80  return static_cast<long long>(1E6);
81 #endif /* (choice of OS) */
82  }
#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

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.

56  {
57  return interval_t(i.value+j.value);
58  }
interval_t()
Construct a time interval representing zero time duration.
Definition: tick_count.h:42

◆ operator- [1/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.

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

◆ operator- [2/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.

61  {
62  return interval_t(i.value-j.value);
63  }
interval_t()
Construct a time interval representing zero time duration.
Definition: tick_count.h:42

◆ 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:

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.