diff options
author | Finn Williams <Finn.Williams@arm.com> | 2019-10-15 14:22:13 +0100 |
---|---|---|
committer | Jim Flynn Arm <jim.flynn@arm.com> | 2019-10-21 16:52:03 +0000 |
commit | 15db745d59a796fd05e3bb5a8b735f25710bdf22 (patch) | |
tree | 01e5e320bd92cb152464adb82c02e3b37342b571 /tests/profiling/gatordmock/DirectoryCaptureCommandHandler.hpp | |
parent | 422f2fb6c7ef13e48124991af6f27e78934b8ece (diff) | |
download | armnn-15db745d59a796fd05e3bb5a8b735f25710bdf22.tar.gz |
IVGCVSW-3989 Create the Counter Directory Decoder
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: If388e60434eae39d82b639d2275680679963624c
Diffstat (limited to 'tests/profiling/gatordmock/DirectoryCaptureCommandHandler.hpp')
-rw-r--r-- | tests/profiling/gatordmock/DirectoryCaptureCommandHandler.hpp | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/tests/profiling/gatordmock/DirectoryCaptureCommandHandler.hpp b/tests/profiling/gatordmock/DirectoryCaptureCommandHandler.hpp new file mode 100644 index 0000000000..4cf96be741 --- /dev/null +++ b/tests/profiling/gatordmock/DirectoryCaptureCommandHandler.hpp @@ -0,0 +1,75 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#pragma once + +#include "CounterDirectory.hpp" +#include "GatordMockService.hpp" +#include "MockUtils.hpp" + + +#include "Packet.hpp" +#include "CommandHandlerFunctor.hpp" +#include "SendCounterPacket.hpp" +#include "IPeriodicCounterCapture.hpp" + + +#include <vector> +#include <thread> +#include <functional> + +namespace armnn +{ + +namespace gatordmock +{ + +class DirectoryCaptureCommandHandler : public profiling::CommandHandlerFunctor +{ + +public: + + DirectoryCaptureCommandHandler(uint32_t familyId, + uint32_t packetId, + uint32_t version, + bool quietOperation = false) + : CommandHandlerFunctor(familyId, packetId, version) + , m_QuietOperation(quietOperation) + , m_CounterDirectoryCount(0) + {} + + void operator()(const armnn::profiling::Packet &packet) override; + + CounterDirectory GetCounterDirectory() const; + uint32_t GetCounterDirectoryCount() const; + +private: + void ParseData(const armnn::profiling::Packet &packet); + + std::vector<CategoryRecord> ReadCategoryRecords(const unsigned char *const data, + uint32_t offset, + std::vector<uint32_t> categoryOffsets); + + std::vector<CounterSetRecord> ReadCounterSetRecords(const unsigned char *const data, + uint32_t offset, + std::vector<uint32_t> eventRecordsOffsets); + + std::vector<DeviceRecord> ReadDeviceRecords(const unsigned char *const data, + uint32_t offset, + std::vector<uint32_t> eventRecordsOffsets); + + std::vector<EventRecord> ReadEventRecords(const unsigned char *const data, + uint32_t offset, + std::vector<uint32_t> eventRecordsOffsets); + + CounterDirectory m_CounterDirectory; + + bool m_QuietOperation; + std::atomic<uint32_t> m_CounterDirectoryCount; +}; + +} // namespace gatordmock + +} // namespace armnn |