diff options
author | Keith Davis <keith.davis@arm.com> | 2021-04-22 10:10:34 +0100 |
---|---|---|
committer | finn.williams <finn.williams@arm.com> | 2021-05-06 19:39:39 +0000 |
commit | e813d67f86df41a238ff79b5c554ef5027f56576 (patch) | |
tree | 54c2145a78297d61e6e94676729cb2468490ade3 /src/armnn/AsyncExecutionCallback.hpp | |
parent | d905decd256558bbee165e636ce4242ac3b9c917 (diff) | |
download | armnn-e813d67f86df41a238ff79b5c554ef5027f56576.tar.gz |
IVGCVSW-5813 Add Async Queue to IRuntime
Signed-off-by: Keith Davis <keith.davis@arm.com>
Change-Id: Icc0d131c8ee2e9748e2f14762a75962b39c10f9d
Diffstat (limited to 'src/armnn/AsyncExecutionCallback.hpp')
-rw-r--r-- | src/armnn/AsyncExecutionCallback.hpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/armnn/AsyncExecutionCallback.hpp b/src/armnn/AsyncExecutionCallback.hpp new file mode 100644 index 0000000000..c17b839748 --- /dev/null +++ b/src/armnn/AsyncExecutionCallback.hpp @@ -0,0 +1,48 @@ +// +// Copyright © 2021 Arm Ltd and Contributors. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include <armnn/IAsyncExecutionCallback.hpp> +#include <armnn/Types.hpp> +#include <condition_variable> + +#include <mutex> +#include <thread> + +namespace armnn +{ + +namespace experimental +{ + +class AsyncExecutionCallback final : public IAsyncExecutionCallback +{ +public: + AsyncExecutionCallback() + {} + ~AsyncExecutionCallback() + {} + + void Notify(armnn::Status status, InferenceTimingPair timeTaken); + void Wait() const; + + armnn::Status GetStatus() const; + HighResolutionClock GetStartTime() const; + HighResolutionClock GetEndTime() const; + +private: + mutable std::mutex m_Mutex; + mutable std::condition_variable m_Condition; + + HighResolutionClock m_StartTime; + HighResolutionClock m_EndTime; + armnn::Status m_Status = Status::Failure; + bool m_Notified = false; +}; + +} // namespace experimental + +} // namespace armnn
\ No newline at end of file |