ArmNN
 21.02
WallClockTimer Class Reference

#include <WallClockTimer.hpp>

Inheritance diagram for WallClockTimer:
Instrument

Public Types

using clock = std::chrono::steady_clock
 

Public Member Functions

 WallClockTimer ()=default
 
 ~WallClockTimer ()=default
 
void Start () override
 
void Stop () override
 
const char * GetName () const override
 
std::vector< MeasurementGetMeasurements () const override
 
- Public Member Functions inherited from Instrument
virtual ~Instrument ()
 

Static Public Attributes

static const std::string WALL_CLOCK_TIME
 
static const std::string WALL_CLOCK_TIME_START
 
static const std::string WALL_CLOCK_TIME_STOP
 

Detailed Description

Definition at line 38 of file WallClockTimer.hpp.

Member Typedef Documentation

◆ clock

using clock = std::chrono::steady_clock

Definition at line 60 of file WallClockTimer.hpp.

Constructor & Destructor Documentation

◆ WallClockTimer()

WallClockTimer ( )
default

◆ ~WallClockTimer()

~WallClockTimer ( )
default

Member Function Documentation

◆ GetMeasurements()

std::vector< Measurement > GetMeasurements ( ) const
overridevirtual

Implements Instrument.

Definition at line 30 of file WallClockTimer.cpp.

References WallClockTimer::WALL_CLOCK_TIME, WallClockTimer::WALL_CLOCK_TIME_START, and WallClockTimer::WALL_CLOCK_TIME_STOP.

Referenced by BOOST_AUTO_TEST_CASE().

31 {
32  const auto delta = std::chrono::duration<double, std::micro>(m_Stop - m_Start);
33  const auto startTimeMs = std::chrono::duration<double, std::micro>(m_Start.time_since_epoch());
34  const auto stopTimeMs = std::chrono::duration<double, std::micro>(m_Stop.time_since_epoch());
35 
36  return { { WALL_CLOCK_TIME, delta.count(), Measurement::Unit::TIME_US },
37  { WALL_CLOCK_TIME_START, startTimeMs.count(), Measurement::Unit::TIME_US },
38  { WALL_CLOCK_TIME_STOP, stopTimeMs.count(), Measurement::Unit::TIME_US } };
39 }
static const std::string WALL_CLOCK_TIME_STOP
static const std::string WALL_CLOCK_TIME_START
static const std::string WALL_CLOCK_TIME

◆ GetName()

const char * GetName ( ) const
overridevirtual

Implements Instrument.

Definition at line 15 of file WallClockTimer.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

16 {
17  return "WallClockTimer";
18 }

◆ Start()

void Start ( )
overridevirtual

Implements Instrument.

Definition at line 20 of file WallClockTimer.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

21 {
22  m_Start = clock::now();
23 }

◆ Stop()

void Stop ( )
overridevirtual

Implements Instrument.

Definition at line 25 of file WallClockTimer.cpp.

Referenced by BOOST_AUTO_TEST_CASE().

26 {
27  m_Stop = clock::now();
28 }

Member Data Documentation

◆ WALL_CLOCK_TIME

◆ WALL_CLOCK_TIME_START

const std::string WALL_CLOCK_TIME_START
static

◆ WALL_CLOCK_TIME_STOP

const std::string WALL_CLOCK_TIME_STOP
static

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