diff options
author | Finn Williams <Finn.Williams@arm.com> | 2020-02-12 11:02:34 +0000 |
---|---|---|
committer | Finn Williams <Finn.Williams@arm.com> | 2020-02-14 10:20:00 +0000 |
commit | 032bc74ca4bc6589a33f23db31accddc5b20baaa (patch) | |
tree | 07ae871bc1d667105c7a4b5da2b670b977d5abcb /src/backends/backendsCommon/test/MockBackend.hpp | |
parent | c1536d69c1468514425e143b0578656f51598b94 (diff) | |
download | armnn-032bc74ca4bc6589a33f23db31accddc5b20baaa.tar.gz |
IVGCVSW-4338 Implement the Activation of Counters in backends
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I4a2465f06e046f78242ff0a246c651638b205498
Diffstat (limited to 'src/backends/backendsCommon/test/MockBackend.hpp')
-rw-r--r-- | src/backends/backendsCommon/test/MockBackend.hpp | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/src/backends/backendsCommon/test/MockBackend.hpp b/src/backends/backendsCommon/test/MockBackend.hpp index 21ce7ab85d..641d67ff24 100644 --- a/src/backends/backendsCommon/test/MockBackend.hpp +++ b/src/backends/backendsCommon/test/MockBackend.hpp @@ -13,6 +13,8 @@ #include <armnn/backends/IBackendInternal.hpp> #include <armnn/backends/OptimizationViews.hpp> #include <backendsCommon/LayerSupportBase.hpp> +#include <armnn/backends/profiling/IBackendProfiling.hpp> +#include <backends/BackendProfiling.hpp> namespace armnn { @@ -53,6 +55,7 @@ class MockBackendProfilingContext : public profiling::IBackendProfilingContext public: MockBackendProfilingContext(IBackendInternal::IBackendProfilingPtr& backendProfiling) : m_BackendProfiling(backendProfiling) + , m_CapturePeriod(0) {} ~MockBackendProfilingContext() = default; @@ -81,19 +84,42 @@ public: return nextMaxGlobalCounterId; } - void ActivateCounters(uint32_t, const std::vector<uint16_t>&) - {} + Optional<std::string> ActivateCounters(uint32_t capturePeriod, const std::vector<uint16_t>& counterIds) + { + if ( capturePeriod == 0 || counterIds.size() == 0) + { + m_ActiveCounters.clear(); + } + else if (capturePeriod == 15939u) + { + return armnn::Optional<std::string>("ActivateCounters example test error"); + } + m_CapturePeriod = capturePeriod; + m_ActiveCounters = counterIds; + return armnn::Optional<std::string>(); + } std::vector<profiling::Timestamp> ReportCounterValues() { - return std::vector<profiling::Timestamp>(); + std::vector<profiling::CounterValue> counterValues; + + for(auto counterId : m_ActiveCounters) + { + counterValues.emplace_back(profiling::CounterValue{counterId, counterId+1u}); + } + + uint64_t timestamp = m_CapturePeriod; + return {profiling::Timestamp{timestamp, counterValues}}; } void EnableProfiling(bool) {} private: + IBackendInternal::IBackendProfilingPtr& m_BackendProfiling; + uint32_t m_CapturePeriod; + std::vector<uint16_t> m_ActiveCounters; }; class MockBackend : public IBackendInternal |