diff options
author | Finn Williams <Finn.Williams@arm.com> | 2020-02-26 10:25:26 +0000 |
---|---|---|
committer | Jim Flynn <jim.flynn@arm.com> | 2020-03-04 14:24:29 +0000 |
commit | 8a2b4685fde869c46ad4ebb19cbfefc4adc2a654 (patch) | |
tree | 4f4c87fe502ebbc595ff60ee588183e3b230ad7c /src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp | |
parent | a97a0be5f16cb876d7226b733ac6aaa3b79dabd3 (diff) | |
download | armnn-8a2b4685fde869c46ad4ebb19cbfefc4adc2a654.tar.gz |
IVGCVSW-4160 Make the ARM Developer Studio code a self contained build entity
!armnn:2773
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Change-Id: I246cf0de04a1d29dd135cb0fc7e55bc5f0d4b854
Diffstat (limited to 'src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp')
-rw-r--r-- | src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp | 115 |
1 files changed, 115 insertions, 0 deletions
diff --git a/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp new file mode 100644 index 0000000000..655e461b8c --- /dev/null +++ b/src/timelineDecoder/TimelineDirectoryCaptureCommandHandler.cpp @@ -0,0 +1,115 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "TimelineDirectoryCaptureCommandHandler.hpp" + +#include <iostream> +#include <string> + +using namespace armnn::profiling; + +namespace armnn +{ + +namespace timelinedecoder +{ + +void TimelineDirectoryCaptureCommandHandler::ParseData(const armnn::profiling::Packet& packet) +{ + uint32_t offset = 0; + + if (packet.GetLength() < 8) + { + return; + } + + const unsigned char* data = packet.GetData(); + + m_SwTraceHeader.m_StreamVersion = ReadUint8(data, offset); + offset += uint8_t_size; + m_SwTraceHeader.m_PointerBytes = ReadUint8(data, offset); + offset += uint8_t_size; + m_SwTraceHeader.m_ThreadIdBytes = ReadUint8(data, offset); + offset += uint8_t_size; + + uint32_t numberOfDeclarations = profiling::ReadUint32(data, offset); + offset += uint32_t_size; + + for (uint32_t declaration = 0; declaration < numberOfDeclarations; ++declaration) + { + m_SwTraceMessages.push_back(profiling::ReadSwTraceMessage(data, offset)); + } +} + +void TimelineDirectoryCaptureCommandHandler::Print() +{ + std::string header; + + header.append(profiling::CentreAlignFormatting("decl_id", 12)); + header.append(" | "); + header.append(profiling::CentreAlignFormatting("decl_name", 20)); + header.append(" | "); + header.append(profiling::CentreAlignFormatting("ui_name", 20)); + header.append(" | "); + header.append(profiling::CentreAlignFormatting("arg_types", 16)); + header.append(" | "); + header.append(profiling::CentreAlignFormatting("arg_names", 80)); + header.append("\n"); + + std::cout << "\n" << "\n"; + std::cout << profiling::CentreAlignFormatting("SW DIRECTORY", static_cast<int>(header.size())); + std::cout << "\n"; + std::cout << std::string(header.size(), '=') << "\n"; + + std::cout << header; + + for (const auto& swTraceMessage : m_SwTraceMessages) + { + std::string body; + + body.append(profiling::CentreAlignFormatting(std::to_string(swTraceMessage.m_Id), 12)); + body.append(" | "); + body.append(profiling::CentreAlignFormatting(swTraceMessage.m_Name, 20)); + body.append(" | "); + body.append(profiling::CentreAlignFormatting(swTraceMessage.m_UiName, 20)); + body.append(" | "); + + std::string argTypes; + for (auto argType: swTraceMessage.m_ArgTypes) + { + argTypes += argType; + argTypes += " "; + } + body.append(profiling::CentreAlignFormatting(argTypes, 16)); + body.append(" | "); + + std::string argNames; + for (auto argName: swTraceMessage.m_ArgNames) + { + argNames += argName + " "; + } + body.append(profiling::CentreAlignFormatting(argNames, 80)); + + body.append("\n"); + + std::cout << std::string(body.size(), '-') << "\n"; + + std::cout << body; + } +} + +void TimelineDirectoryCaptureCommandHandler::operator()(const profiling::Packet& packet) +{ + ParseData(packet); + + if (!m_QuietOperation) + { + Print(); + } +} + +} //namespace gatordmock + +} //namespace armnn |