MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / CommonOptions

Method CommonOptions

tests/framework/command_line/CommonOptions.cpp:40–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38namespace framework
39{
40CommonOptions::CommonOptions(CommandLineParser &parser)
41 : help(parser.add_option<ToggleOption>("help")),
42 instruments(),
43 iterations(parser.add_option<SimpleOption<int>>("iterations", 1)),
44 log_format(),
45 log_file(parser.add_option<SimpleOption<std::string>>("log-file")),
46 log_level(),
47 throw_errors(parser.add_option<ToggleOption>("throw-errors")),
48#if !defined(_WIN64)
49 color_output(parser.add_option<ToggleOption>(
50 "color-output", isatty(STDOUT_FILENO))), // Only enable colors by default if we're running in a terminal
51#else // !defined(_WIN64)
52 color_output(parser.add_option<ToggleOption>("color-output", 0)),
53#endif // !defined(_WIN64)
54 pretty_console(parser.add_option<ToggleOption>("pretty-console", false)),
55 json_file(parser.add_option<SimpleOption<std::string>>("json-file")),
56 pretty_file(parser.add_option<SimpleOption<std::string>>("pretty-file")),
57 log_streams()
58{
59 Framework &framework = Framework::get();
60 std::set<InstrumentsDescription> allowed_instruments{
61 std::pair<InstrumentType, ScaleFactor>(InstrumentType::ALL, ScaleFactor::NONE),
62 std::pair<InstrumentType, ScaleFactor>(InstrumentType::NONE, ScaleFactor::NONE),
63 };
64
65 for (const auto &type : framework.available_instruments())
66 {
67 allowed_instruments.insert(type);
68 }
69
70 std::set<LogFormat> supported_log_formats{
71 LogFormat::NONE,
72 LogFormat::PRETTY,
73 LogFormat::JSON,
74 };
75
76 std::set<LogLevel> supported_log_levels{
77 LogLevel::NONE, LogLevel::CONFIG, LogLevel::TESTS, LogLevel::ERRORS,
78 LogLevel::WARNINGS, LogLevel::DEBUG, LogLevel::MEASUREMENTS, LogLevel::ALL,
79 };
80
81 instruments = parser.add_option<EnumListOption<InstrumentsDescription>>(
82 "instruments", allowed_instruments,
83 std::initializer_list<InstrumentsDescription>{
84 std::pair<InstrumentType, ScaleFactor>(InstrumentType::WALL_CLOCK_TIMER, ScaleFactor::NONE)});
85 log_format = parser.add_option<EnumOption<LogFormat>>("log-format", supported_log_formats, LogFormat::PRETTY);
86 log_level = parser.add_option<EnumOption<LogLevel>>("log-level", supported_log_levels, LogLevel::ALL);
87
88 help->set_help("Show this help message");
89 instruments->set_help("Set the profiling instruments to use");
90 iterations->set_help("Number of iterations per test case");
91 log_format->set_help("Output format for measurements and failures (affects only log-file)");
92 log_file->set_help("Write output to file instead of to the console (affected by log-format)");
93 log_level->set_help("Verbosity of the output");
94 throw_errors->set_help("Don't catch fatal errors (useful for debugging)");
95 color_output->set_help("Produce colored output on the console");
96 pretty_console->set_help("Produce pretty output on the console");
97 json_file->set_help("Write output to a json file.");

Callers

nothing calls this directly

Calls 2

available_instrumentsMethod · 0.80
set_helpMethod · 0.80

Tested by

no test coverage detected