Compute Library
 23.08
CommonOptions.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2018 Arm Limited.
3  *
4  * SPDX-License-Identifier: MIT
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to
8  * deal in the Software without restriction, including without limitation the
9  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10  * sell copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in all
14  * copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22  * SOFTWARE.
23  */
24 #ifndef ARM_COMPUTE_TEST_COMMONOPTIONS
25 #define ARM_COMPUTE_TEST_COMMONOPTIONS
26 
27 #include "../instruments/Instruments.h"
28 
31 
32 #include <memory>
33 
34 namespace arm_compute
35 {
36 namespace test
37 {
38 namespace framework
39 {
40 class Printer;
41 enum class LogFormat;
42 enum class LogLevel;
43 
44 /** Common command line options used to configure the framework
45  *
46  * The options in this object get populated when "parse()" is called on the parser used to construct it.
47  * The expected workflow is:
48  *
49  * CommandLineParser parser;
50  * CommonOptions options( parser );
51  * parser.parse(argc, argv);
52  * if(options.log_level->value() > LogLevel::NONE) --> Use the options values
53  */
55 {
56 public:
57  /** Constructor
58  *
59  * @param[in,out] parser A parser on which "parse()" hasn't been called yet.
60  */
62  /** Prevent instances of this class from being copy constructed */
63  CommonOptions(const CommonOptions &) = delete;
64  /** Prevent instances of this class from being copied */
65  CommonOptions &operator=(const CommonOptions &) = delete;
66  /** Create the printers based on parsed command line options
67  *
68  * @pre "parse()" has been called on the parser used to construct this object
69  *
70  * @return List of printers
71  */
72  std::vector<std::unique_ptr<Printer>> create_printers();
73 
74  arm_compute::utils::ToggleOption *help; /**< Show help option */
76  arm_compute::utils::SimpleOption<int> *iterations; /**< Number of iterations option */
79  arm_compute::utils::EnumOption<LogLevel> *log_level; /**< Logging level option */
80  arm_compute::utils::ToggleOption *throw_errors; /**< Throw errors option */
81  arm_compute::utils::ToggleOption *color_output; /**< Color output option */
82  arm_compute::utils::ToggleOption *pretty_console; /**< Pretty console option */
83  arm_compute::utils::SimpleOption<std::string> *json_file; /**< JSON output file option */
84  arm_compute::utils::SimpleOption<std::string> *pretty_file; /**< Pretty output file option */
85  std::vector<std::shared_ptr<std::ofstream>> log_streams; /**< Log streams */
86 };
87 
88 } // namespace framework
89 } // namespace test
90 } // namespace arm_compute
91 #endif /* ARM_COMPUTE_TEST_COMMONOPTIONS */
arm_compute::test::framework::CommonOptions
Common command line options used to configure the framework.
Definition: CommonOptions.h:54
arm_compute::test::framework::CommonOptions::operator=
CommonOptions & operator=(const CommonOptions &)=delete
Prevent instances of this class from being copied.
CommandLineOptions.h
arm_compute::test::framework::CommonOptions::color_output
arm_compute::utils::ToggleOption * color_output
Color output option.
Definition: CommonOptions.h:81
arm_compute::test::framework::CommonOptions::help
arm_compute::utils::ToggleOption * help
Show help option.
Definition: CommonOptions.h:74
arm_compute::test::framework::CommonOptions::log_format
arm_compute::utils::EnumOption< LogFormat > * log_format
Log format option.
Definition: CommonOptions.h:77
GemmTuner.parser
parser
Definition: GemmTuner.py:640
arm_compute::test::framework::CommonOptions::create_printers
std::vector< std::unique_ptr< Printer > > create_printers()
Create the printers based on parsed command line options.
Definition: CommonOptions.cpp:102
arm_compute::utils::CommandLineParser
Class to parse command line arguments.
Definition: CommandLineParser.h:45
arm_compute::test::framework::CommonOptions::log_streams
std::vector< std::shared_ptr< std::ofstream > > log_streams
Log streams.
Definition: CommonOptions.h:85
arm_compute::test::framework::CommonOptions::pretty_file
arm_compute::utils::SimpleOption< std::string > * pretty_file
Pretty output file option.
Definition: CommonOptions.h:84
arm_compute::test::framework::CommonOptions::CommonOptions
CommonOptions(arm_compute::utils::CommandLineParser &parser)
Constructor.
Definition: CommonOptions.cpp:40
CommandLineParser.h
arm_compute::utils::ToggleOption
Implementation of an option that can be either true or false.
Definition: ToggleOption.h:36
arm_compute::utils::EnumListOption< InstrumentsDescription >
arm_compute::utils::EnumOption< LogFormat >
arm_compute::test::framework::LogFormat
LogFormat
Definition: Printers.h:36
arm_compute::test::framework::CommonOptions::iterations
arm_compute::utils::SimpleOption< int > * iterations
Number of iterations option.
Definition: CommonOptions.h:76
arm_compute::test::framework::CommonOptions::instruments
arm_compute::utils::EnumListOption< InstrumentsDescription > * instruments
Instruments option.
Definition: CommonOptions.h:75
arm_compute
Copyright (c) 2017-2023 Arm Limited.
Definition: introduction.dox:24
arm_compute::test::framework::CommonOptions::pretty_console
arm_compute::utils::ToggleOption * pretty_console
Pretty console option.
Definition: CommonOptions.h:82
arm_compute::test::framework::CommonOptions::json_file
arm_compute::utils::SimpleOption< std::string > * json_file
JSON output file option.
Definition: CommonOptions.h:83
arm_compute::test::framework::CommonOptions::log_level
arm_compute::utils::EnumOption< LogLevel > * log_level
Logging level option.
Definition: CommonOptions.h:79
arm_compute::test::framework::CommonOptions::throw_errors
arm_compute::utils::ToggleOption * throw_errors
Throw errors option.
Definition: CommonOptions.h:80
arm_compute::utils::SimpleOption< int >
arm_compute::test::framework::LogLevel
LogLevel
Severity of the information.
Definition: Exceptions.h:50
arm_compute::test::framework::CommonOptions::log_file
arm_compute::utils::SimpleOption< std::string > * log_file
Log file option.
Definition: CommonOptions.h:78