DASH  0.3.0
dash::util::Timer< TimeMeasure::Clock > Class Template Reference

Public Types

typedef Timestamp::counter_t timestamp_t
 
typedef Timestamp_t timestamp_type
 
typedef timestamp_t timestamp
 

Public Member Functions

 Timer (const self_t &other)=default
 
Timeroperator= (const self_t &other)
 
double Elapsed () const
 Microseconds elapsed since instantiation of this Timer object. More...
 
const timestamp_t & Start () const
 Returns timestamp from instantiation of this Timer. More...
 

Static Public Member Functions

static double ElapsedSince (timestamp_t timestamp)
 Microseconds elapsed since given timestamp. More...
 
static timestamp_t Now ()
 Produces current timestamp. More...
 
static double FromInterval (const timestamp_t &start, const timestamp_t &end)
 Convert interval of two timestamp values to microseconds. More...
 
static double FromInterval (const double &start, const double &end)
 Convert interval of two timestamp values to mircoseconds. More...
 
static void Calibrate (unsigned int freq=0)
 
static const char * TimerName ()
 
static Timestamp::counter_t TimestampInfinity ()
 
static Timestamp::counter_t TimestampNegInfinity ()
 
static double FrequencyScaling ()
 

Detailed Description

template<>
class dash::util::Timer< TimeMeasure::Clock >

Definition at line 32 of file Timer.h.

Member Function Documentation

◆ Elapsed()

double dash::util::Timer< TimeMeasure::Clock >::Elapsed ( ) const
inline

Microseconds elapsed since instantiation of this Timer object.

Definition at line 79 of file Timer.h.

80  {
81  timestamp_t now;
82  Timestamp_t timestamp;
83  now = timestamp.Value();
84  return (static_cast<double>(now - timestampStart) *
85  static_cast<double>(Timestamp_t::FrequencyPrescale())) /
86  static_cast<double>(Timestamp_t::FrequencyScaling());
87  }

◆ ElapsedSince()

static double dash::util::Timer< TimeMeasure::Clock >::ElapsedSince ( timestamp_t  timestamp)
inlinestatic

Microseconds elapsed since given timestamp.

Definition at line 100 of file Timer.h.

101  {
102  Timestamp_t now;
103  return (static_cast<double>(now.Value() - timestamp) *
104  static_cast<double>(Timestamp_t::FrequencyPrescale())) /
105  static_cast<double>(Timestamp_t::FrequencyScaling());
106  }

◆ FromInterval() [1/2]

static double dash::util::Timer< TimeMeasure::Clock >::FromInterval ( const timestamp_t &  start,
const timestamp_t &  end 
)
inlinestatic

Convert interval of two timestamp values to microseconds.

Definition at line 120 of file Timer.h.

123  {
124  return (static_cast<double>(end - start) *
125  static_cast<double>(Timestamp_t::FrequencyPrescale())) /
126  static_cast<double>(Timestamp_t::FrequencyScaling());
127  }
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
Definition: Range.h:98

◆ FromInterval() [2/2]

static double dash::util::Timer< TimeMeasure::Clock >::FromInterval ( const double &  start,
const double &  end 
)
inlinestatic

Convert interval of two timestamp values to mircoseconds.

Definition at line 132 of file Timer.h.

135  {
136  return ((end - start) *
137  Timestamp_t::FrequencyPrescale() /
138  Timestamp_t::FrequencyScaling());
139  }
constexpr auto end(RangeType &&range) -> decltype(std::forward< RangeType >(range).end())
Definition: Range.h:98

◆ Now()

static timestamp_t dash::util::Timer< TimeMeasure::Clock >::Now ( )
inlinestatic

Produces current timestamp.

Definition at line 111 of file Timer.h.

112  {
113  Timestamp_t timestamp;
114  return timestamp.Value();
115  }

◆ Start()

const timestamp_t& dash::util::Timer< TimeMeasure::Clock >::Start ( ) const
inline

Returns timestamp from instantiation of this Timer.

Definition at line 92 of file Timer.h.

93  {
94  return timestampStart;
95  }

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