diff options
author | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-09-05 12:02:04 +0100 |
---|---|---|
committer | Matteo Martincigh <matteo.martincigh@arm.com> | 2019-09-09 16:47:50 +0000 |
commit | 149528e88c081e71fc7ec78e0c301eb2e487adfc (patch) | |
tree | a287157d725f3186c44f9c8f71141cd694333249 /src/profiling/SendCounterPacket.hpp | |
parent | a85e215dd1b027c5ef88621d1b4d5f6e078605da (diff) | |
download | armnn-149528e88c081e71fc7ec78e0c301eb2e487adfc.tar.gz |
IVGCVSW-3691 Basic refactoring in view of upcoming work in the profiler
Change-Id: Iea4550b864fc2adb04a3a2411a7ead06b1f60ab9
Signed-off-by: Matteo Martincigh <matteo.martincigh@arm.com>
Diffstat (limited to 'src/profiling/SendCounterPacket.hpp')
-rw-r--r-- | src/profiling/SendCounterPacket.hpp | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/profiling/SendCounterPacket.hpp b/src/profiling/SendCounterPacket.hpp index 0fc3055dfd..3238b351a3 100644 --- a/src/profiling/SendCounterPacket.hpp +++ b/src/profiling/SendCounterPacket.hpp @@ -20,11 +20,14 @@ class SendCounterPacket : public ISendCounterPacket public: using IndexValuePairsVector = std::vector<std::pair<uint16_t, uint32_t>>; - SendCounterPacket(IBufferWrapper& buffer) : m_Buffer(buffer), m_ReadyToRead(false) {}; + SendCounterPacket(IBufferWrapper& buffer) + : m_Buffer(buffer), + m_ReadyToRead(false) + {} void SendStreamMetaDataPacket() override; - void SendCounterDirectoryPacket(const Category& category, const std::vector<Counter>& counters) override; + void SendCounterDirectoryPacket(const CounterDirectory& counterDirectory) override; void SendPeriodicCounterCapturePacket(uint64_t timestamp, const IndexValuePairsVector& values) override; @@ -37,6 +40,16 @@ public: static const unsigned int MAX_METADATA_PACKET_LENGTH = 4096; private: + template <typename ExceptionType> + void CancelOperationAndThrow(const std::string& errorMessage) + { + // Cancel the operation + m_Buffer.Commit(0); + + // Throw a runtime exception with the given error message + throw ExceptionType(errorMessage); + } + IBufferWrapper& m_Buffer; bool m_ReadyToRead; }; |