11#include <boost/program_options.hpp>
12#include <boost/program_options/cmdline.hpp>
13#include <boost/program_options/errors.hpp>
14#include <boost/program_options/options_description.hpp>
15#include <boost/program_options/positional_options.hpp>
16#include <boost/program_options/variables_map.hpp>
22#include <unordered_map>
24#include "sparta/report/Report.hpp"
30#include "sparta/trigger/Trigger.hpp"
31#include "sparta/trigger/Triggerable.hpp"
32#include "sparta/pevents/PeventTrigger.hpp"
33#include "sparta/pevents/PeventController.hpp"
37namespace boost::program_options {
45namespace sparta::trigger {
50namespace po = boost::program_options;
51namespace pocls = boost::program_options::command_line_style;
54class InformationWriter;
58const constexpr char DefaultHeartbeat[] =
"0";
158 return advanced_opts_;
166 return positional_opts_;
327 std::unordered_map<std::string, app::ReportYamlReplacements>
459 std::unique_ptr<sparta::trigger::Trigger> pipeline_trigger_;
460 std::unique_ptr<sparta::InformationWriter> info_out_;
483 bool run_pevents_ =
false;
504 bool use_pyshell_ =
false;
509 void printUsageHelp_()
const;
514 void printOptionsHelp_(uint32_t level)
const;
519 void showVerboseHelp_()
const;
524 void showBriefHelp_()
const;
529 void showHelpTopics_()
const;
536 bool openALFAndFindPipelineNodes_(
const std::string & alf_filename);
606 po::options_description all_opts_;
611 po::positional_options_description positional_opts_;
616 po::variables_map vm_;
622 std::vector<std::string> unrecognized_opts_;
629 std::unique_ptr<trigger::Trigger> debug_trigger_;
Application-infrastructure triggers.
Wrapper for boost program_options option_description that allows multiple levels of detail.
Describes reports to instantiate and tracks their instantiations.
A simple time-based, event precedence based scheduler.
Simulation setup base class.
static const Tick INDEFINITE
Constant for infinite tick count.
Command line simulator front-end class with argument parsing Works in conjunction with sparta::app::S...
app::ReportYamlReplacements report_yaml_placeholder_replacements_
Vector of yaml placeholder key-value pairs. These will be applied to the yamls given by "--report my_...
bool parse(int argc, char **argv, int &err_code)
Parse command line options.
void populateSimulation_(Simulation *sim)
Implements populateSimulation.
std::string pipeline_heartbeat_
Heartbeat period of pipeline collection file (before lexical cast or validation)
bool is_parsed_
Have the command line options been parsed yet by this class through the parse method.
virtual void postParse_(po::basic_parsed_options< char > &opts)
Callback before interpreting command parsed command line tokens.
void runSimulator(Simulation *sim, uint64_t ticks)
Run the simulator for the specified number of ticks.
std::string final_config_file_verbose_
Destination to which final configuration (before running) will be written ("" if not written)....
virtual ~CommandLineSimulator()
Destructor.
std::unique_ptr< sparta::trigger::Triggerable > pipeline_collection_triggerable_
Instance of the pipeline collector if collection enabled.
std::string read_final_config_
The file to read from for reading in a final config file.
SimulationConfiguration sim_config_
Simulation configuration including default values.
std::string debug_dump_options_
When a simulation error occurs and error logging is enabled, what content should the error log contai...
ReportDescVec reports_
Vector of Report descriptors to instantiate on the simulator.
po::positional_options_description & getPositionalOptions()
Gets the boost positional options for the parser owned by this simulator.
std::string dump_debug_type_
Under what conditions should the debug content be dumped at simulator destruction....
char ** argv_
argv from main
std::string auto_summary_
Automatic summary state. Determines what to do with the automatic summary after running.
void runSimulator(Simulation *sim)
Run the simulator.
bool show_counters_
Display all counters and stats in the device tree after finalization.
bool show_notifications_
Display all notifications in the device tree after finalization excluding log messages.
MultiDetailOptions & getAdvancedOptions()
Gets the advanced options for this simulator.
uint64_t run_time_cycles_
Run-time user parameter.
CommandLineSimulator(const std::string &usage, const DefaultValues &defs=DEFAULTS)
Construct.
const std::string usage_
Usage string specified at construction.
std::unique_ptr< sparta::trigger::Triggerable > pevent_trigger_
The filename to log pevents too.
void postProcess_(Simulation *sim)
Implements postProcess.
std::vector< std::string > report_descriptor_def_files_
Vector of report descriptor definition files (YAML)
std::string final_config_file_
Destination to which final configuration (before running) will be written ("" if not written)
FeatureConfiguration feature_config_
Simulation feature configuration.
bool show_clocks_
Display all the clocks in the tree.
const po::variables_map & getVariablesMap() const
Variables map populated by command-line parsing. This map is populated within the parse() method.
bool show_loggers_
Display all notifications in the device tree after finalization excluding log messages.
uint32_t config_applicators_used_
number of non-final configuration applications used to modify parameters. A tally of all -p,...
void postProcess(Simulation *sim)
Post-process the results of the simulation if applicable.
std::set< std::string > pipeline_enabled_node_names_
The names of the nodes to be enabled.
bool show_pevents_
Display all the pevent types in the tree.
MultiDetailOptions & getApplicationOptions()
Gets the application-specific options for this simulator.
int parse(int argc, char **argv)
DEPRECATED Shorthand version of other parse method,.
bool isParsed() const
Has this simulator parsed the command line yet Being parsed is required to call for populateSimulatio...
SimulationConfiguration & getSimulationConfiguration()
bool show_parameters_
Display all parameters in the device tree after building.
std::string help_topic_
Help topic to show.
const MultiDetailOptions & getSpartaOptions() const
Gets the sparta-specific options for this simulator.
bool isSetup() const
Has this simulator been setup yet? Being set up is required to call runSimulator.
bool show_tree_
Display the device tree at every opportunity.
const SimulationConfiguration & getSimulationConfiguration() const
static DefaultValues DEFAULTS
Static DefaultValues for a SPARTA CommandLineSimulator.
const std::string & getUsage() const
Gets the usage string specified for this simulator at construction. This string is printed when usage...
std::unordered_map< std::string, app::ReportYamlReplacements > report_specific_yaml_placeholder_replacements_
Map to hold report-specific yaml placeholder key-value pairs. An example usage might be: <sim> –repor...
pevents::PeventCollectorController pevent_controller_
a pevent controller is used to parse in pevent on and off commands, and prepare collection for the sp...
bool isRuntimeFinite() const
bool no_run_mode_
Is this simulator in no-run mode where it quits just before finalization.
bool show_hidden_
Show hidden treenodes when displaying the device tree.
bool is_setup_
Has the simulator been setup through the populateSimulation method.
std::string runtime_clock_
The runtime clock to use for -r option.
bool no_show_config_
Should the trivialities of simulator configuration (e.g what command line options were specified) be ...
bool show_ports_
Display all ports in the device tree after finalization.
void runSimulator_(Simulation *sim, uint64_t ticks)
Implements runSimulator.
bool disable_colors_
Show hidden treenodes when displaying the device tree.
std::string power_config_file_
Destination to which power configuration (to be read by power model) will be written ("" if not writt...
void populateSimulation(Simulation *sim)
Builds the content of the simulator making it ready to run.
CommandLineSimulator()=delete
Not default constructable.
Optional default values for the simulator which can be customized and provided by anyone instantiatin...
Collection of named feature values.
Class for containing multiple levels of boost program options.
Configuration applicator class that is used for configuring a simulator. Works in conjunction with sp...
Simulator which builds a sparta DeviceTree.
Simple class for recursively adding taps to pevents. There is probably a more efficient way than each...
Sparta Application framework.
Macros for handling exponential backoff.