ArmNN
 20.02
NeonInterceptorScheduler.cpp
Go to the documentation of this file.
1 //
2 // Copyright © 2017 Arm Ltd. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
7 
8 #include <boost/assert.hpp>
9 
10 namespace armnn{
11 
12 NeonInterceptorScheduler::NeonInterceptorScheduler(arm_compute::IScheduler &realScheduler)
13  : m_Kernels(nullptr), m_RealScheduler(realScheduler)
14 {
15 }
16 
17 void NeonInterceptorScheduler::set_num_threads(unsigned int numThreads)
18 {
19  m_RealScheduler.set_num_threads(numThreads);
20 }
21 
23 {
24  return m_RealScheduler.num_threads();
25 }
26 
27 void NeonInterceptorScheduler::schedule(arm_compute::ICPPKernel* kernel, const Hints& hints)
28 {
29  WallClockTimer::clock::time_point startTime = WallClockTimer::clock::now();
30  m_RealScheduler.schedule(kernel, hints.split_dimension());
31  WallClockTimer::clock::time_point stopTime = WallClockTimer::clock::now();
32 
33  const auto delta = std::chrono::duration<double, std::micro>(stopTime - startTime);
34  m_Kernels->emplace_back(kernel->name(), delta.count(), Measurement::Unit::TIME_US);
35 }
36 
37 void NeonInterceptorScheduler::run_workloads(std::vector <Workload>& workloads)
38 {
39  WallClockTimer::clock::time_point startTime = WallClockTimer::clock::now();
40  m_RealScheduler.run_tagged_workloads(workloads, nullptr);
41  WallClockTimer::clock::time_point stopTime = WallClockTimer::clock::now();
42 
43  const auto delta = std::chrono::duration<double, std::micro>(stopTime - startTime);
44  m_Kernels->emplace_back(std::string("Workload"), delta.count(), Measurement::Unit::TIME_US);
45 }
46 
47 void NeonInterceptorScheduler::run_tagged_workloads(std::vector<Workload> &workloads, const char *tag)
48 {
49  WallClockTimer::clock::time_point startTime = WallClockTimer::clock::now();
50  m_RealScheduler.run_tagged_workloads(workloads, tag);
51  WallClockTimer::clock::time_point stopTime = WallClockTimer::clock::now();
52 
53  const auto delta = std::chrono::duration<double, std::micro>(stopTime - startTime);
54  m_Kernels->emplace_back(std::string(tag != nullptr ? tag : "Unknown"), delta.count(), Measurement::Unit::TIME_US);
55 }
56 
57 } // namespace armnn
Copyright (c) 2020 ARM Limited.
unsigned int num_threads() const override
void schedule(arm_compute::ICPPKernel *kernel, const Hints &hints) override
void run_tagged_workloads(std::vector< Workload > &workloads, const char *tag) override
NeonInterceptorScheduler(arm_compute::IScheduler &realScheduler)
void set_num_threads(unsigned int numThreads) override
void run_workloads(std::vector< Workload > &workloads) override