diff options
author | Nina Drozd <nina.drozd@arm.com> | 2018-09-21 18:42:09 +0100 |
---|---|---|
committer | Matthew Bentham <matthew.bentham@arm.com> | 2018-10-10 16:16:57 +0100 |
commit | 69851b525b9040ee7bf4b796efe74d473bc4e321 (patch) | |
tree | 1a3b0ae764a6bc4c4249c69df198fef3bb92c833 /src/armnn/WallClockTimer.cpp | |
parent | e448be3ac55897a3eabe85962891f8414f8e3cf9 (diff) | |
download | armnn-69851b525b9040ee7bf4b796efe74d473bc4e321.tar.gz |
IVGCVSW-1821 - update NEON workload utils to use timers in correct order, updated units used in NeonTimer
Change-Id: I593af42bd2930dd9d147354b706087e3ac260fe9
Diffstat (limited to 'src/armnn/WallClockTimer.cpp')
-rw-r--r-- | src/armnn/WallClockTimer.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/armnn/WallClockTimer.cpp b/src/armnn/WallClockTimer.cpp index 882b7eb6ef..911b0147e0 100644 --- a/src/armnn/WallClockTimer.cpp +++ b/src/armnn/WallClockTimer.cpp @@ -4,6 +4,7 @@ // #include "WallClockTimer.hpp" +#include "armnn/Exceptions.hpp" namespace armnn { @@ -27,15 +28,34 @@ void WallClockTimer::Stop() m_Stop = clock::now(); } +void WallClockTimer::SetScaleFactor(Measurement::Unit measurementUnit) +{ + switch(measurementUnit) + { + case Measurement::TIME_MS: + m_ScaleFactor = 1.f; + break; + case Measurement::TIME_US: + m_ScaleFactor = 1000.f; + break; + case Measurement::TIME_NS: + m_ScaleFactor = 1000000.f; + break; + default: + throw InvalidArgumentException("Invalid scale used"); + } + m_Unit = measurementUnit; +} + std::vector<Measurement> WallClockTimer::GetMeasurements() const { const auto delta = std::chrono::duration<double, std::milli>(m_Stop - m_Start); const auto startTimeMs = std::chrono::duration<double, std::milli>(m_Start.time_since_epoch()); const auto stopTimeMs = std::chrono::duration<double, std::milli>(m_Stop.time_since_epoch()); - return { { WALL_CLOCK_TIME, delta.count(), Measurement::Unit::TIME_MS }, - { WALL_CLOCK_TIME_START, startTimeMs.count(), Measurement::Unit::TIME_MS }, - { WALL_CLOCK_TIME_STOP, stopTimeMs.count(), Measurement::Unit::TIME_MS } }; + return { { WALL_CLOCK_TIME, delta.count() * m_ScaleFactor, m_Unit }, + { WALL_CLOCK_TIME_START, startTimeMs.count() * m_ScaleFactor, m_Unit }, + { WALL_CLOCK_TIME_STOP, stopTimeMs.count() * m_ScaleFactor, m_Unit } }; } } //namespace armnn |