ArmNN
 21.05
AsyncExecutionCallback.cpp
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 
7 
8 namespace armnn
9 {
10 
11 namespace experimental
12 {
13 
15 {
16  {
17  std::lock_guard<std::mutex> hold(m_Mutex);
18  if (m_Notified)
19  {
20  return;
21  }
22  // store results and mark as notified
23  m_Status = status;
24  m_StartTime = timeTaken.first;
25  m_EndTime = timeTaken.second;
26  m_Notified = true;
27  }
28  m_Condition.notify_all();
29 }
30 
32 {
33  std::unique_lock<std::mutex> lock(m_Mutex);
34  m_Condition.wait(lock, [this] { return m_Notified; });
35 }
36 
38 {
39  Wait();
40  return m_Status;
41 }
42 
44 {
45  Wait();
46  return m_StartTime;
47 }
48 
50 {
51  Wait();
52  return m_EndTime;
53 }
54 
55 } // namespace experimental
56 
57 } // 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