diff options
author | Colm Donelan <Colm.Donelan@arm.com> | 2019-10-11 13:09:49 +0100 |
---|---|---|
committer | Colm Donelan <Colm.Donelan@arm.com> | 2019-10-11 13:12:37 +0100 |
commit | a21620d32a8a0a8d527c061e2a22d51009d75877 (patch) | |
tree | b08ffee4cddb1bb3b1d206c67ea80bc2093d7bf5 /tests/profiling/gatordmock/CommandLineProcessor.cpp | |
parent | 67ef2a52c3cdcc37538d77711bbcea2f0e5655e5 (diff) | |
download | armnn-a21620d32a8a0a8d527c061e2a22d51009d75877.tar.gz |
IVGCVSW-3721 Add support for startup sequence (Mock Gatord service).
* Receive and process the stream metadata from the client.
* Send the connection ack packet.
* Wait in a receiving thread and print the packets.
* GatordMockTest and Impl for PeriodicCounterCapture CommandHandler
* CaptureData class to retain packet data
* MockUtils
* Update SocketProfilingConnection to fix non blocking receipt of packets.
* Restructure directory layout following review comments.
* Extract the mock service into a static library in the cmake files.
Signed-off-by: Colm Donelan <Colm.Donelan@arm.com>
Signed-off-by: Keith Davis <keith.davis@arm.com>
Signed-off-by: Mike Kelly <mike.kelly@arm.com>
Signed-off-by: Finn Williams <Finn.Williams@arm.com>
Signed-off-by: Kevin May <kevin.may@arm.com>
Change-Id: I33c1c9f93976708c9315f71290d42cff53b8c075
Diffstat (limited to 'tests/profiling/gatordmock/CommandLineProcessor.cpp')
-rw-r--r-- | tests/profiling/gatordmock/CommandLineProcessor.cpp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/tests/profiling/gatordmock/CommandLineProcessor.cpp b/tests/profiling/gatordmock/CommandLineProcessor.cpp new file mode 100644 index 0000000000..55b51137bc --- /dev/null +++ b/tests/profiling/gatordmock/CommandLineProcessor.cpp @@ -0,0 +1,72 @@ +// +// Copyright © 2019 Arm Ltd. All rights reserved. +// SPDX-License-Identifier: MIT +// + +#include "CommandLineProcessor.hpp" + +#include <boost/program_options.hpp> +#include <iostream> + +namespace armnn +{ +namespace gatordmock +{ + +bool CommandLineProcessor::ProcessCommandLine(int argc, char *argv[]) +{ + namespace po = boost::program_options; + po::options_description desc("Options"); + try + { + desc.add_options() + ("help,h", "Display help messages") + ("file,f", po::value<std::string>(&m_File), + "The path to the file that contains instructions for the mock gatord") + ("namespace,n", po::value<std::string>(&m_UdsNamespace)->default_value("gatord_namespace"), + "The Unix domain socket namespace this server will bind to.\n" + "This will always be prepended with \\0 to use the abstract namespace") + ("echo,e", po::bool_switch(&m_Echo)->default_value(false), + "Echo packets sent and received to stdout. Disabled by default.\n"); + } + catch (const std::exception& e) + { + std::cerr << "Fatal internal error: [" << e.what() << "]" << std::endl; + return false; + } + + po::variables_map vm; + try + { + po::store(po::parse_command_line(argc, argv, desc), vm); + + if (vm.count("help")) + { + std::cout << "Simulate a Gatord server to interact with ArmNN external profiling." << std::endl; + std::cout << std::endl; + std::cout << desc << std::endl; + return false; + } + // Currently the file parameter is mandatory. + if (!vm.count("file")) + { + std::cout << std::endl << "*** Expected --file or -f parameter." << std::endl; + std::cout << std::endl; + std::cout << desc << std::endl; + return false; + } + po::notify(vm); + } + catch (const po::error& e) + { + std::cerr << e.what() << std::endl << std::endl; + std::cerr << desc << std::endl; + return false; + } + + return true; +} + +} // namespace gatordmock + +} // namespace armnn
\ No newline at end of file |