2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // See LICENSE file in the project root for full license information.
6 #include "NeonTimer.hpp"
7 #include "NeonInterceptorScheduler.hpp"
11 #include <boost/assert.hpp>
12 #include <boost/format.hpp>
17 void NeonTimer::Start()
20 m_RealSchedulerType = arm_compute::Scheduler::get_type();
21 //Note: We can't currently replace a custom scheduler
22 if(m_RealSchedulerType != arm_compute::Scheduler::Type::CUSTOM)
24 // Keep the real schedule and add NeonInterceptorScheduler as an interceptor
25 m_RealScheduler = &arm_compute::Scheduler::get();
26 auto interceptor = std::make_shared<NeonInterceptorScheduler>(m_Kernels, *m_RealScheduler);
27 arm_compute::Scheduler::set(std::static_pointer_cast<arm_compute::IScheduler>(interceptor));
31 void NeonTimer::Stop()
33 // Restore real scheduler
34 arm_compute::Scheduler::set(m_RealSchedulerType);
35 m_RealScheduler = nullptr;
38 std::vector<Measurement> NeonTimer::GetMeasurements() const
40 std::vector<Measurement> measurements = m_Kernels;
41 unsigned int kernel_number = 0;
42 for (auto & kernel : measurements)
44 std::string kernelName = std::string(this->GetName()) + "/" + std::to_string(kernel_number++) + ": " + kernel
46 kernel.m_Name = kernelName;
51 const char* NeonTimer::GetName() const
53 return "NeonKernelTimer";