ArmNN
 22.05
AsyncExecutionCallback Class Referencefinal

#include <AsyncExecutionCallback.hpp>

Inheritance diagram for AsyncExecutionCallback:
IAsyncExecutionCallback

Public Member Functions

 AsyncExecutionCallback (std::queue< InferenceId > &notificationQueue, std::mutex &mutex, std::condition_variable &condition)
 
 ~AsyncExecutionCallback ()
 
void Notify (armnn::Status status, InferenceTimingPair timeTaken)
 
InferenceId GetInferenceId ()
 
armnn::Status GetStatus () const
 
HighResolutionClock GetStartTime () const
 
HighResolutionClock GetEndTime () const
 
- Public Member Functions inherited from IAsyncExecutionCallback
virtual ~IAsyncExecutionCallback ()
 

Detailed Description

Definition at line 25 of file AsyncExecutionCallback.hpp.

Constructor & Destructor Documentation

◆ AsyncExecutionCallback()

AsyncExecutionCallback ( std::queue< InferenceId > &  notificationQueue,
std::mutex &  mutex,
std::condition_variable &  condition 
)
inline

Definition at line 31 of file AsyncExecutionCallback.hpp.

37  : m_NotificationQueue(notificationQueue)
38 #if !defined(ARMNN_DISABLE_THREADS)
39  , m_Mutex(mutex)
40  , m_Condition(condition)
41 #endif
42  , m_InferenceId(++nextID)
43  {}

◆ ~AsyncExecutionCallback()

Definition at line 45 of file AsyncExecutionCallback.hpp.

References AsyncExecutionCallback::Notify().

46  {}

Member Function Documentation

◆ GetEndTime()

HighResolutionClock GetEndTime ( ) const

Definition at line 41 of file AsyncExecutionCallback.cpp.

Referenced by AsyncExecutionCallback::GetInferenceId().

42 {
43  return m_EndTime;
44 }

◆ GetInferenceId()

InferenceId GetInferenceId ( )
inline

◆ GetStartTime()

HighResolutionClock GetStartTime ( ) const

Definition at line 36 of file AsyncExecutionCallback.cpp.

Referenced by AsyncExecutionCallback::GetInferenceId().

37 {
38  return m_StartTime;
39 }

◆ GetStatus()

armnn::Status GetStatus ( ) const

Definition at line 31 of file AsyncExecutionCallback.cpp.

Referenced by AsyncExecutionCallback::GetInferenceId().

32 {
33  return m_Status;
34 }

◆ Notify()

void Notify ( armnn::Status  status,
InferenceTimingPair  timeTaken 
)
virtual

Implements IAsyncExecutionCallback.

Definition at line 14 of file AsyncExecutionCallback.cpp.

Referenced by AsyncExecutionCallback::~AsyncExecutionCallback().

15 {
16  {
17 #if !defined(ARMNN_DISABLE_THREADS)
18  std::lock_guard<std::mutex> hold(m_Mutex);
19 #endif
20  // store results and mark as notified
21  m_Status = status;
22  m_StartTime = timeTaken.first;
23  m_EndTime = timeTaken.second;
24  m_NotificationQueue.push(m_InferenceId);
25  }
26 #if !defined(ARMNN_DISABLE_THREADS)
27  m_Condition.notify_all();
28 #endif
29 }

The documentation for this class was generated from the following files: