Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CR 1217061 : xrt-smi advanced --help prints Alveo help #8545

Merged
merged 6 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 13 additions & 19 deletions src/runtime_src/core/tools/xbutil2/OO_Reports.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,19 @@ print_preemption_telemetry(const xrt_core::device* device)
// ----- C L A S S M E T H O D S -------------------------------------------

OO_Reports::OO_Reports( const std::string &_longName, bool _isHidden )
: OptionOptions(_longName, _isHidden, "Hidden reports")
: OptionOptions(_longName, _isHidden, "Reports to generate: clocks, preemption")
, m_device("")
, m_action("")
, m_help(false)
{
m_optionsDescription.add_options()
("device,d", boost::program_options::value<decltype(m_device)>(&m_device), "The Bus:Device.Function (e.g., 0000:d8:00.0) device of interest")
("help", boost::program_options::bool_switch(&m_help), "Help to use this sub-command")
("mode", boost::program_options::value<decltype(m_action)>(&m_action)->required(), "Action to perform: clocks, preemption")
;

m_optionsHidden.add_options()
("mode", boost::program_options::value<decltype(m_action)>(&m_action)->required(), "Action to perform: clocks, preemption");

m_positionalOptions.
add("mode", 1 /* max_count */)
;
Expand All @@ -100,25 +102,17 @@ OO_Reports::execute(const SubCmdOptions& _options) const

// Parse sub-command ...
po::variables_map vm;
process_arguments(vm, _options);

try {
po::options_description all_options("All Options");
all_options.add(m_optionsDescription);
po::command_line_parser parser(_options);
XBUtilities::process_arguments(vm, parser, all_options, m_positionalOptions, true);
} catch(boost::program_options::error&) {
if(m_help) {
printHelp();
throw xrt_core::error(std::errc::operation_canceled);
}
// Exit if neither action or device specified
if(m_action.empty()) {
std::cerr << boost::format("ERROR: the required argument for option '--report' is missing\n");
printHelp();
throw xrt_core::error(std::errc::operation_canceled);
}
if (m_help) {
printHelp();
return;
}
if(m_action.empty()) {
std::cerr << boost::format("ERROR: the required argument for option '--report' is missing\n");
printHelp();
throw xrt_core::error(std::errc::operation_canceled);
}

// Find device of interest
std::shared_ptr<xrt_core::device> device;

Expand Down
5 changes: 3 additions & 2 deletions src/runtime_src/core/tools/xbutil2/SubCmdAdvanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ namespace po = boost::program_options;

SubCmdAdvanced::SubCmdAdvanced(bool _isHidden, bool _isDepricated, bool _isPreliminary, const boost::property_tree::ptree& configurations)
: SubCmd("advanced",
"Low level command operations")
"Low level command operations"),
m_device("")
{
const std::string longDescription = "Low level command operations.";
setLongDescription(longDescription);
Expand Down Expand Up @@ -89,5 +90,5 @@ SubCmdAdvanced::execute(const SubCmdOptions& _options) const
optionOption->setGlobalOptions(getGlobalOptions());

// Execute the option
optionOption->execute(topOptions);
optionOption->execute(_options);
}
1 change: 1 addition & 0 deletions src/runtime_src/core/tools/xbutil2/SubCmdAdvanced.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class SubCmdAdvanced : public SubCmd {

private:
bool m_help;
std::string m_device;
};

#endif
Expand Down
Loading