ArmNN
 21.05
AsyncExecutionCallback.hpp
Go to the documentation of this file.
1 //
2 // Copyright © 2021 Arm Ltd and Contributors. All rights reserved.
3 // SPDX-License-Identifier: MIT
4 //
5 
6 #pragma once
7 
9 #include <armnn/Types.hpp>
10 #include <condition_variable>
11 
12 #include <mutex>
13 #include <thread>
14 
15 namespace armnn
16 {
17 
18 namespace experimental
19 {
20 
22 {
23 public:
25  {}
27  {}
28 
29  void Notify(armnn::Status status, InferenceTimingPair timeTaken);
30  void Wait() const;
31 
32  armnn::Status GetStatus() const;
35 
36 private:
37  mutable std::mutex m_Mutex;
38  mutable std::condition_variable m_Condition;
39 
40  HighResolutionClock m_StartTime;
41  HighResolutionClock m_EndTime;
42  armnn::Status m_Status = Status::Failure;
43  bool m_Notified = false;
44 };
45 
46 } // namespace experimental
47 
48 } // namespace armnn
std::chrono::high_resolution_clock::time_point HighResolutionClock
Define a timer and associated inference ID for recording execution times.
Definition: Types.hpp:319
void Notify(armnn::Status status, InferenceTimingPair timeTaken)
Copyright (c) 2021 ARM Limited and Contributors.
Status
enumeration
Definition: Types.hpp:30
std::pair< HighResolutionClock, HighResolutionClock > InferenceTimingPair
Definition: Types.hpp:320