aboutsummaryrefslogtreecommitdiff
path: root/src/profiling/test/SendCounterPacketTests.hpp
diff options
context:
space:
mode:
authorMatteo Martincigh <matteo.martincigh@arm.com>2019-10-10 14:08:21 +0100
committerMatteo Martincigh <matteo.martincigh@arm.com>2019-10-11 16:33:29 +0100
commite848538efbdf01aa0b067da942c3c214f8e62826 (patch)
treed700239f1316a098849fcfc39ec70e926f86fd62 /src/profiling/test/SendCounterPacketTests.hpp
parentf982deaefbe5fe5814487b27f7099829839b8666 (diff)
downloadarmnn-e848538efbdf01aa0b067da942c3c214f8e62826.tar.gz
IVGCVSW-3964 Implement the Periodic Counter Selection command handler
* Improved the PeriodicCounterPacket class to handle errors properly * Improved the PeriodicCounterSelectionCommandHandler to handle invalid counter UIDs in the selection packet * Added the Periodic Counter Selection command handler to the ProfilingService class * Code refactoring and added comments * Added WaitForPacketSent method to the SendCounterPacket class to allow waiting for the packets to be sent (useful in the unit tests) * Added unit tests and updated the old ones accordingly * Fixed threading issues with a number of unit tests Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com> Change-Id: I271b7b0bfa801d88fe1725b934d24e30cd839ed7
Diffstat (limited to 'src/profiling/test/SendCounterPacketTests.hpp')
-rw-r--r--src/profiling/test/SendCounterPacketTests.hpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/profiling/test/SendCounterPacketTests.hpp b/src/profiling/test/SendCounterPacketTests.hpp
index 871ca74124..73fc39b437 100644
--- a/src/profiling/test/SendCounterPacketTests.hpp
+++ b/src/profiling/test/SendCounterPacketTests.hpp
@@ -7,6 +7,7 @@
#include <SendCounterPacket.hpp>
#include <ProfilingUtils.hpp>
+#include <IProfilingConnectionFactory.hpp>
#include <armnn/Exceptions.hpp>
#include <armnn/Optional.hpp>
@@ -74,11 +75,13 @@ public:
return std::move(m_Packet);
}
- const std::vector<uint32_t> GetWrittenData() const
+ const std::vector<uint32_t> GetWrittenData()
{
std::lock_guard<std::mutex> lock(m_Mutex);
- return m_WrittenData;
+ std::vector<uint32_t> writtenData = m_WrittenData;
+ m_WrittenData.clear();
+ return writtenData;
}
void Clear()
@@ -95,6 +98,15 @@ private:
mutable std::mutex m_Mutex;
};
+class MockProfilingConnectionFactory : public IProfilingConnectionFactory
+{
+public:
+ IProfilingConnectionPtr GetProfilingConnection(const ExternalProfilingOptions& options) const override
+ {
+ return std::make_unique<MockProfilingConnection>();
+ }
+};
+
class MockPacketBuffer : public IPacketBuffer
{
public: