ArmNN
 24.08
AsyncExecutionCallback Class Referencefinal

#include <AsyncExecutionCallback.hpp>

Inheritance diagram for AsyncExecutionCallback:
[legend]
Collaboration diagram for AsyncExecutionCallback:
[legend]

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.

46  {}

Member Function Documentation

◆ GetEndTime()

HighResolutionClock GetEndTime ( ) const

Definition at line 43 of file AsyncExecutionCallback.cpp.

44 {
45  return m_EndTime;
46 }

◆ GetInferenceId()

InferenceId GetInferenceId ( )
inline

Definition at line 50 of file AsyncExecutionCallback.hpp.

51  {
52  return m_InferenceId;
53  }

◆ GetStartTime()

HighResolutionClock GetStartTime ( ) const

Definition at line 38 of file AsyncExecutionCallback.cpp.

39 {
40  return m_StartTime;
41 }

◆ GetStatus()

armnn::Status GetStatus ( ) const

Definition at line 33 of file AsyncExecutionCallback.cpp.

34 {
35  return m_Status;
36 }

◆ Notify()

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

Implements IAsyncExecutionCallback.

Definition at line 16 of file AsyncExecutionCallback.cpp.

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

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