ArmNN
 24.02
WallClockTimer.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #include "WallClockTimer.hpp"
7 
8 namespace armnn
9 {
10 
11 const std::string WallClockTimer::WALL_CLOCK_TIME ("Wall clock time");
14 
15 const char* WallClockTimer::GetName() const
16 {
17  return "WallClockTimer";
18 }
19 
21 {
22  m_Start = clock::now();
23 }
24 
26 {
27  m_Stop = clock::now();
28 }
29 
30 std::vector<Measurement> WallClockTimer::GetMeasurements() const
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 }
40 
41 } //namespace armnn
armnn::WallClockTimer::WALL_CLOCK_TIME_STOP
static const std::string WALL_CLOCK_TIME_STOP
Definition: WallClockTimer.hpp:65
armnn::WallClockTimer::GetMeasurements
std::vector< Measurement > GetMeasurements() const override
Definition: WallClockTimer.cpp:30
WallClockTimer.hpp
armnn::WallClockTimer::Stop
void Stop() override
Definition: WallClockTimer.cpp:25
armnn::WallClockTimer::WALL_CLOCK_TIME
static const std::string WALL_CLOCK_TIME
Definition: WallClockTimer.hpp:63
armnn::WallClockTimer::Start
void Start() override
Definition: WallClockTimer.cpp:20
armnn
Copyright (c) 2021 ARM Limited and Contributors.
Definition: 01_00_quick_start.dox:6
armnn::WallClockTimer::WALL_CLOCK_TIME_START
static const std::string WALL_CLOCK_TIME_START
Definition: WallClockTimer.hpp:64
armnn::WallClockTimer::GetName
const char * GetName() const override
Definition: WallClockTimer.cpp:15