aboutsummaryrefslogtreecommitdiff
path: root/src/armnn/NeonInterceptorScheduler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/armnn/NeonInterceptorScheduler.cpp')
-rw-r--r--src/armnn/NeonInterceptorScheduler.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/armnn/NeonInterceptorScheduler.cpp b/src/armnn/NeonInterceptorScheduler.cpp
new file mode 100644
index 0000000000..fc95ef439e
--- /dev/null
+++ b/src/armnn/NeonInterceptorScheduler.cpp
@@ -0,0 +1,57 @@
+//
+// Copyright © 2017 Arm Ltd. All rights reserved.
+// See LICENSE file in the project root for full license information.
+//
+
+#include "NeonInterceptorScheduler.hpp"
+
+#include <boost/assert.hpp>
+
+namespace armnn{
+
+NeonInterceptorScheduler::NeonInterceptorScheduler(NeonTimer::KernelMeasurements& kernels,
+ arm_compute::IScheduler &realScheduler)
+ : m_Kernels(kernels), m_RealScheduler(realScheduler)
+{
+}
+
+void NeonInterceptorScheduler::set_num_threads(unsigned int numThreads)
+{
+ m_RealScheduler.set_num_threads(numThreads);
+}
+
+unsigned int NeonInterceptorScheduler::num_threads() const
+{
+ return m_RealScheduler.num_threads();
+}
+
+void NeonInterceptorScheduler::schedule(arm_compute::ICPPKernel* kernel, const Hints& hints)
+{
+ m_Timer.Start();
+ m_RealScheduler.schedule(kernel, hints.split_dimension());
+ m_Timer.Stop();
+
+ std::vector<Measurement> measurements = m_Timer.GetMeasurements();
+ BOOST_ASSERT(!measurements.empty());
+
+ Measurement measurement(measurements.front()); // NOTE: 1st measurement is delta
+ measurement.m_Name = kernel->name();
+ m_Kernels.push_back(std::move(measurement));
+}
+
+void NeonInterceptorScheduler::run_workloads(std::vector <Workload>& workloads)
+{
+ m_Timer.Start();
+ m_RealScheduler.run_workloads(workloads);
+ m_Timer.Stop();
+
+ std::vector<Measurement> measurements = m_Timer.GetMeasurements();
+ BOOST_ASSERT_MSG(measurements.size() == 3, "WallClockTimer does not have correct amount of measurements.");
+
+ // WallClockTimer has 3 measurements, duration always being the first.
+ Measurement measurement(measurements.front());
+ measurement.m_Name = "Workload";
+ m_Kernels.push_back(std::move(measurement));
+}
+
+} // namespace armnn \ No newline at end of file