IVGCVSW-1821 - update NEON workload utils to use timers in correct order, updated units used in NeonTimer

Change-Id: I593af42bd2930dd9d147354b706087e3ac260fe9
diff --git a/src/armnn/NeonInterceptorScheduler.cpp b/src/armnn/NeonInterceptorScheduler.cpp
index 8363def..7e2737e 100644
--- a/src/armnn/NeonInterceptorScheduler.cpp
+++ b/src/armnn/NeonInterceptorScheduler.cpp
@@ -31,6 +31,7 @@
     m_RealScheduler.schedule(kernel, hints.split_dimension());
     m_Timer.Stop();
 
+    m_Timer.SetScaleFactor(Measurement::Unit::TIME_US);
     std::vector<Measurement> measurements = m_Timer.GetMeasurements();
     BOOST_ASSERT(!measurements.empty());
 
@@ -46,6 +47,7 @@
     m_RealScheduler.run_tagged_workloads(workloads, nullptr);
     m_Timer.Stop();
 
+    m_Timer.SetScaleFactor(Measurement::Unit::TIME_US);
     std::vector<Measurement> measurements = m_Timer.GetMeasurements();
     BOOST_ASSERT_MSG(measurements.size() == 3, "WallClockTimer does not have correct amount of measurements.");
 
diff --git a/src/armnn/WallClockTimer.cpp b/src/armnn/WallClockTimer.cpp
index 882b7eb..911b014 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 @@
     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
diff --git a/src/armnn/WallClockTimer.hpp b/src/armnn/WallClockTimer.hpp
index 5e88382..09cc514 100644
--- a/src/armnn/WallClockTimer.hpp
+++ b/src/armnn/WallClockTimer.hpp
@@ -42,6 +42,8 @@
     // Get the name of the timer
     const char* GetName() const override;
 
+    void SetScaleFactor(Measurement::Unit measurementUnit);
+
     // Get the recorded measurements
     std::vector<Measurement> GetMeasurements() const override;
 
@@ -58,6 +60,8 @@
 private:
     clock::time_point m_Start;
     clock::time_point m_Stop;
+    float m_ScaleFactor = 1.f;
+    Measurement::Unit m_Unit = Measurement::Unit::TIME_MS;
 };
 
 } //namespace armnn
diff --git a/src/armnn/test/JsonPrinterTests.cpp b/src/armnn/test/JsonPrinterTests.cpp
index 18adfc2..01078e3 100644
--- a/src/armnn/test/JsonPrinterTests.cpp
+++ b/src/armnn/test/JsonPrinterTests.cpp
@@ -276,7 +276,7 @@
             break;
         case armnn::Compute::CpuAcc: backend = "Neon";
             changeLine31 = ",\n\"NeonKernelTimer/: NEFillBorderKernel\": {";
-            changeLine39 = R"(ms"
+            changeLine39 = R"(us"
 },
 "NeonKernelTimer/: NELogitsDMaxKernel": {
 "raw": [
@@ -284,7 +284,7 @@
 ,
 
 ],
-"unit": "ms"
+"unit": "us"
 },
 "NeonKernelTimer/: NELogitsDSoftmaxKernel": {
 "raw": [
@@ -292,7 +292,7 @@
 ,
 
 ],
-"unit": "ms")";
+"unit": "us")";
             changeLine40 = R"(
 },
 "CopyMemGeneric_Execute": {
diff --git a/src/backends/NeonWorkloadUtils.hpp b/src/backends/NeonWorkloadUtils.hpp
index 15f9e3b..f3c8866 100644
--- a/src/backends/NeonWorkloadUtils.hpp
+++ b/src/backends/NeonWorkloadUtils.hpp
@@ -30,5 +30,5 @@
 #define     ARMNN_SCOPED_PROFILING_EVENT_NEON(name) \
     ARMNN_SCOPED_PROFILING_EVENT_WITH_INSTRUMENTS(armnn::Compute::CpuAcc, \
                                                   name, \
-                                                  armnn::WallClockTimer(), \
-                                                  armnn::NeonTimer())
+                                                  armnn::NeonTimer(), \
+                                                  armnn::WallClockTimer())