2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
6 #include "WallClockTimer.hpp"
11 const std::string WallClockTimer::WALL_CLOCK_TIME ("Wall clock time");
12 const std::string WallClockTimer::WALL_CLOCK_TIME_START(WallClockTimer::WALL_CLOCK_TIME + " (Start)");
13 const std::string WallClockTimer::WALL_CLOCK_TIME_STOP (WallClockTimer::WALL_CLOCK_TIME + " (Stop)");
15 const char* WallClockTimer::GetName() const
17 return "WallClockTimer";
20 void WallClockTimer::Start()
22 m_Start = clock::now();
25 void WallClockTimer::Stop()
27 m_Stop = clock::now();
30 std::vector<Measurement> WallClockTimer::GetMeasurements() const
32 const auto delta = std::chrono::duration<double, std::milli>(m_Stop - m_Start);
33 const auto startTimeMs = std::chrono::duration<double, std::milli>(m_Start.time_since_epoch());
34 const auto stopTimeMs = std::chrono::duration<double, std::milli>(m_Stop.time_since_epoch());
36 return { { WALL_CLOCK_TIME, delta.count(), Measurement::Unit::TIME_MS },
37 { WALL_CLOCK_TIME_START, startTimeMs.count(), Measurement::Unit::TIME_MS },
38 { WALL_CLOCK_TIME_STOP, stopTimeMs.count(), Measurement::Unit::TIME_MS } };