The Sparta Modeling Framework
|
Configuration applicator class that is used for configuring a simulator. Works in conjunction with sparta::app::Simulation. More...
#include <SimulationConfiguration.hpp>
Public Types | |
enum class | SignalMode { DISABLE_BACKTRACE_SIGNALS , ENABLE_BACKTRACE_SIGNALS } |
Controls installation of signal handlers. More... | |
enum class | PostRunDebugDumpPolicy { DEBUG_DUMP_ALWAYS = 0 , DEBUG_DUMP_NEVER = 1 , DEBUG_DUMP_ERROR = 2 , DEBUG_DUMP_MAX = 3 } |
enum class | PostRunDebugDumpOptions { DEBUG_DUMP_EVERYTHING , DEBUG_DUMP_NOTHING , DEBUG_DUMP_BACKTRACE_ONLY } |
enum class | AutoSummaryState { AUTO_SUMMARY_OFF = 0 , AUTO_SUMMARY_NORMAL = 1 , AUTO_SUMMARY_VERBOSE = 2 , AUTO_SUMMARY_MAX = 3 } |
enum class | TriggerSource { TRIGGER_ON_NONE = 0 , TRIGGER_ON_CYCLE , TRIGGER_ON_INSTRUCTION , TRIGGER_ON_ROI } |
Public Member Functions | |
SimulationConfiguration (const DefaultValues &defaults=DefaultValues()) | |
Create a SimulationConfiguration. | |
void | processParameter (const std::string &pattern, const std::string &value, bool optional=false) |
void | processConfigFile (const std::string &pattern, const std::string &filename, bool is_final=false) |
void | processArch (const std::string &pattern, const std::string &filename) |
void | enableLogging (const std::string &pattern, const std::string &category, const std::string &destination) |
bool | hasFinalConfig () const |
Was a final configuration file provided? | |
void | processExtensionFile (const std::string &filename) |
Consume an extension (.yaml) file. | |
void | setStateTrackingFile (const std::string &filename) |
Set the filename for the State Tracking file. | |
const std::string & | getStateTrackingFilename () const |
Get the State Tracking filename. | |
void | addControlFile (const std::string &filename) |
Consume a simulation control file. | |
const std::set< std::string > & | getControlFiles () const |
Get all control files for this simulation. | |
void | addRunMetadata (const std::string &name, const std::string &value) |
Add run metadata as a string. | |
const std::vector< std::pair< std::string, std::string > > & | getRunMetadata () const |
Get run metadata as key-value pairs. | |
std::string | stringizeRunMetadata () const |
Get run metadata stringized as "name1=value1,name2=value2,...". | |
std::string | getFinalConfigFile () const |
Get the final config file name. | |
void | setMemoryUsageDefFile (const std::string &def_file) |
Set filename which contains heap profiler settings. | |
const std::string & | getMemoryUsageDefFile () const |
Get filename for heap profiler configuration. | |
void | generateStatsMapping () |
Auto-generate mappings from report column headers to statistic names. | |
bool | shouldGenerateStatsMapping () const |
Get statistics mapping "enabled" flag. | |
void | disablePrettyPrintReports (const std::string &format) |
const std::set< std::string > & | getDisabledPrettyPrintFormats () const |
Get all report file extensions which have had their pretty printing disabled. | |
void | omitStatsWithValueZeroForReportFormat (const std::string &format) |
const std::set< utils::lowercase_string > & | getReportFormatsWhoOmitStatsWithValueZero () const |
Get all report formats which are to omit all SI values that are zero. | |
void | copyTreeNodeExtensionsFromArchAndConfigPTrees () |
ParameterTree & | getUnboundParameterTree () |
const ParameterTree & | getUnboundParameterTree () const |
ParameterTree & | getArchUnboundParameterTree () |
const ParameterTree & | getArchUnboundParameterTree () const |
ParameterTree & | getExtensionsUnboundParameterTree () |
Returns a ParameterTree containing an unbound set of named tree node extensions and their parameter value(s). | |
const ParameterTree & | getExtensionsUnboundParameterTree () const |
Returns a ParameterTree (const version) containing an unbound set of named tree node extensions and their parameter value(s). | |
bool | archFileProvided () const |
void | printArchConfigurations (std::ostream &os) const |
Print the ArchNodeConfigFileApplicator for informative messages. | |
void | addArchSearchPath (const std::string &dir) |
const std::vector< std::string > & | getArchSearchPath () const |
Get the arch search paths. | |
void | addConfigSearchPath (const std::string &dir) |
const std::vector< std::string > & | getConfigSearchPath () const |
Get the search paths for the configure files. | |
void | addReportDefnSearchPath (const std::string &dir) |
const std::vector< std::string > & | getReportDefnSearchPaths () const |
void | printGenericConfigurations (std::ostream &os) const |
Print the generic configurations for informative messages. | |
void | setSimulationDatabaseLocation (const std::string &loc) |
void | addSimulationDatabaseAccessOptsYaml (const std::string &opts_file) |
void | setLegacyReportsCopyDir (const std::string &reports_root_dir, const std::set< std::string > &collected_formats={}) |
const std::string & | getSimulationDatabaseLocation () const |
const std::vector< std::string > & | getDatabaseAccessOptsFiles () const |
const std::string & | getLegacyReportsCopyDir () const |
const std::set< std::string > & | getLegacyReportsCollectedFormats () const |
const DefaultValues & | getDefaults () const |
Get the defaults this configuration was made with. | |
const log::TapDescVec & | getTaps () const |
Get the taps vector. | |
void | setConsumed () const |
Configuration applicator class that is used for configuring a simulator. Works in conjunction with sparta::app::Simulation.
This class will help a user set up a derived sparta::app::Simulation object, but nothing else. It's up the user to determine how to run simulation, either by calling sparta::app::Simulation::run directly or via the sparta::SysCSpartaSchedulerAdapter::run method if the simulation is embedded in a cosimulation environment where the SystemC scheduler is master of simulation.
Definition at line 118 of file SimulationConfiguration.hpp.
|
strong |
Behavior of auto-summary writing
Enumerator | |
---|---|
AUTO_SUMMARY_OFF | Do not write summary. |
AUTO_SUMMARY_NORMAL | Write normal summary. |
AUTO_SUMMARY_VERBOSE | Write verbose summary. |
AUTO_SUMMARY_MAX | Invalid enum value. |
Definition at line 521 of file SimulationConfiguration.hpp.
|
strong |
Content of post-run debug dumping
Definition at line 512 of file SimulationConfiguration.hpp.
|
strong |
Behavior of post-run debug dumping
Definition at line 502 of file SimulationConfiguration.hpp.
|
strong |
Controls installation of signal handlers.
Definition at line 493 of file SimulationConfiguration.hpp.
|
strong |
Type of trigger to create using trigger_on_value for enabling pipeout collection, logging, and pevents
Definition at line 532 of file SimulationConfiguration.hpp.
|
inline |
Append to the front of the architectural directory paths list the given directory
Definition at line 290 of file SimulationConfiguration.hpp.
|
inline |
Append to the front of the configuration directory path list the given directory
Definition at line 306 of file SimulationConfiguration.hpp.
|
inline |
Append to the front of the report definitions directory path list the given directory
Definition at line 322 of file SimulationConfiguration.hpp.
|
inline |
Add a YAML options file specifying which components are allowed to access the simulation database, and (optionally) when that access is to be granted or removed during simulation.
\code stats: components: top.cpu.core0.rob root.clocks bpred: start: notif.dbaccess == 1 stop: notif.dbaccess == 0 \endcode
In the above example, this would mean that for the "stats" database namespace, components "top.cpu.core0.rob" and "root.clocks" are the only ones that can access the database, and they can access it at any time.
For the "bpred" namespace however, all components / device tree locations can access the database when the notification channel "dbaccess" has emitted a value of 1, but they are restricted from accessing the database when the same channel emits a value of 0.
This YAML file could also list specific components that can access the database, as well as start/stop triggers for finer control over when the database is available for those components. For example:
\code bpred: components: top.cpu.core0.rob start: notif.dbaccess == 1 stop: notif.dbaccess == 0 || notif.earlyterm == 1 \endcode
The syntax for the "start" and "stop" database triggers is the same as report triggers found in YAML descriptor files (–report <file.yaml>)
\code stats: start: top.core0.rob.stats.total_number_retired >= 1000 tag: t0 bpred: stop: t0.start \endcode
Definition at line 403 of file SimulationConfiguration.hpp.
|
inline |
Was an arch file provided in this configuration?
Definition at line 274 of file SimulationConfiguration.hpp.
void sparta::app::SimulationConfiguration::copyTreeNodeExtensionsFromArchAndConfigPTrees | ( | ) |
Look for any tree node extensions from the arch / config ParameterTree's, and merge those extensions into the extensions ParameterTree.
void sparta::app::SimulationConfiguration::disablePrettyPrintReports | ( | const std::string & | format | ) |
Disable pretty printing for the given file format ("json", "html", ...) Note that not all formats differentiate between pretty print and non-pretty print, so calling this method will have no effect for those reports
void sparta::app::SimulationConfiguration::enableLogging | ( | const std::string & | pattern, |
const std::string & | category, | ||
const std::string & | destination | ||
) |
Enable logging on a specific node, for a specific category, and redirect output to the given destination
|
inline |
Get the arch search paths.
Definition at line 298 of file SimulationConfiguration.hpp.
|
inline |
Returns an architectural ParameterTree containing an unbound set of parameter values which can be read and later applied as defaults to newly-constructed parameters.
Definition at line 245 of file SimulationConfiguration.hpp.
|
inline |
Returns an architectural ParameterTree (const version) containing an unbound set of parameter values which can be read and later applied as defaults to newly-constructed parameters.
Definition at line 252 of file SimulationConfiguration.hpp.
|
inline |
Get the search paths for the configure files.
Definition at line 314 of file SimulationConfiguration.hpp.
|
inline |
Get the list of SimDB access YAML files that specify which components have been granted access to the simulation database, and (optionally) when they that access is to be enabled / disabled using trigger expressions.
Definition at line 467 of file SimulationConfiguration.hpp.
|
inline |
Get the defaults this configuration was made with.
Definition at line 671 of file SimulationConfiguration.hpp.
|
inline |
Returns a ParameterTree containing an unbound set of named tree node extensions and their parameter value(s).
Definition at line 258 of file SimulationConfiguration.hpp.
|
inline |
Returns a ParameterTree (const version) containing an unbound set of named tree node extensions and their parameter value(s).
Definition at line 267 of file SimulationConfiguration.hpp.
|
inline |
Get the final config file name.
Definition at line 184 of file SimulationConfiguration.hpp.
|
inline |
Get the specific legacy report formats that are being collected. If empty, either all formats are being collected, or the report collection command line option is not being used.
Definition at line 486 of file SimulationConfiguration.hpp.
|
inline |
Get the root directory where all of this simulation's legacy reports were copied to.
Definition at line 476 of file SimulationConfiguration.hpp.
|
inline |
Return all report definition search paths applied to this simulation (command line option –report-search-path)
Definition at line 330 of file SimulationConfiguration.hpp.
|
inline |
Get the simulation database location configured for this simulation. This will return an empty string if a non-default location was never set at the command line.
Definition at line 457 of file SimulationConfiguration.hpp.
|
inline |
Get the taps vector.
Definition at line 674 of file SimulationConfiguration.hpp.
|
inline |
Returns a ParameterTree containing an unbound set of parameter values which can be read and later applied. Some of these parameters will be applied to Parameter TreeNodes at some point and others will not
Definition at line 230 of file SimulationConfiguration.hpp.
|
inline |
Returns a ParameterTree (const version) containing an unbound set of parameter values which can be read and later applied. Some of these parameters will be applied to Parameter TreeNodes at some point and others will not
Definition at line 238 of file SimulationConfiguration.hpp.
|
inline |
Was a final configuration file provided?
Definition at line 156 of file SimulationConfiguration.hpp.
void sparta::app::SimulationConfiguration::omitStatsWithValueZeroForReportFormat | ( | const std::string & | format | ) |
Specify that a given report format (NOT a report extension) is to omit StatisticInstance's that have value 0. To be clear, report format is something like "json" or "json_reduced", while the report extension for both of these formats is just "json".
|
inline |
Print the ArchNodeConfigFileApplicator for informative messages.
Definition at line 277 of file SimulationConfiguration.hpp.
|
inline |
Print the generic configurations for informative messages.
Definition at line 335 of file SimulationConfiguration.hpp.
void sparta::app::SimulationConfiguration::processArch | ( | const std::string & | pattern, |
const std::string & | filename | ||
) |
Configure simulator for specific architecture. Will look in the directories supplied in arch_search_paths
void sparta::app::SimulationConfiguration::processConfigFile | ( | const std::string & | pattern, |
const std::string & | filename, | ||
bool | is_final = false |
||
) |
Consume a configuration (.yaml) file
pattern | The node to apply the given yaml file. Use "" for top |
filename | The yaml file to consume |
is_final | Is this a final configuration file |
void sparta::app::SimulationConfiguration::processParameter | ( | const std::string & | pattern, |
const std::string & | value, | ||
bool | optional = false |
||
) |
Handle an individual parameter
pattern | The path to the parameter node to modify |
value | The value to be written |
ignore | Is this an optional parameter? |
|
inline |
Called by app::Simulation to indicate that this configuration has been consumed. Const since this class is passed as a const object to app::Simulation
Definition at line 679 of file SimulationConfiguration.hpp.
|
inline |
Set the root directory where all of this simulation's legacy reports should be copied to. Say the root directory was set to "/tmp" and the simulation was configured to produce the following report files:
Filename Format ------------- ----------- foo.csv csv_cumulative foo.json json_reduced bar.json json_reduced baz.json json_detail
If the SimDB file ended up being "abcd-1234.db", then the simulation would copy (not move) the four legacy reports listed above into a directory structure that looks like:
/tmp /abcd-1234 /csv_cumulative foo.csv /json_reduced foo.json bar.json /json_detail baz.json
reports_root_dir | Root directory where the reports will be copied. Directory will be created if needed. |
collected_formats | Specific report formats you want to collect. If left empty, all formats will be collected. |
Definition at line 442 of file SimulationConfiguration.hpp.
|
inline |
Set the location of the SimDB file produced during simulation
Definition at line 344 of file SimulationConfiguration.hpp.
AutoSummaryState sparta::app::SimulationConfiguration::auto_summary_state {AutoSummaryState::AUTO_SUMMARY_OFF} |
Automatic summary state. Determines what to do with the automatic summary after running. Valid values are found in sparta::app""Simulation.
Definition at line 579 of file SimulationConfiguration.hpp.
PostRunDebugDumpOptions sparta::app::SimulationConfiguration::debug_dump_options {PostRunDebugDumpOptions::DEBUG_DUMP_EVERYTHING} |
Debug dumping options
Definition at line 589 of file SimulationConfiguration.hpp.
PostRunDebugDumpPolicy sparta::app::SimulationConfiguration::debug_dump_policy {PostRunDebugDumpPolicy::DEBUG_DUMP_NEVER} |
Debug dumping policy
Definition at line 584 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::debug_sim = false |
Should simulator-framework debug messages be written
Definition at line 559 of file SimulationConfiguration.hpp.
std::string sparta::app::SimulationConfiguration::dump_debug_filename {"error-dump.dbg"} |
Filename of error/final dump. Can be "" to auto-generate the name
Definition at line 594 of file SimulationConfiguration.hpp.
std::string sparta::app::SimulationConfiguration::parsed_path_to_retired_inst_counter_ |
From "top.core*", what is the path to the counter specifying retired instructions on a given core?
Definition at line 665 of file SimulationConfiguration.hpp.
std::pair<std::string, app::DefaultValues::RetiredInstPathStrictness> sparta::app::SimulationConfiguration::path_to_retired_inst_counter |
Definition at line 666 of file SimulationConfiguration.hpp.
std::string sparta::app::SimulationConfiguration::pipeline_collection_file_prefix = NoPipelineCollectionStr |
The default pipeline collection prefix for pipeline collection (-z option). Empty string means no prefix
Definition at line 633 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::report_on_error = true |
Write reports o error
Definition at line 564 of file SimulationConfiguration.hpp.
ReportDescVec sparta::app::SimulationConfiguration::reports |
Additional report descriptions
Definition at line 638 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::scheduler_exacting_run = false |
Scheduler control: When a user calls sparta::Simulation::run() with an amount of time other than the default, the Scheduler can do one of two things:
If this boolean is set to true, the Scheduler will perform the first action. If set to false it will perform the second action.
Definition at line 653 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::scheduler_measure_run_time = true |
Scheduler control: When a user calls sparta::Simulation::run(), should the Scheduler measure its own performance? This is expensive (and pointless) if a user of SPARTA is doing a run that is less than infinite.
Definition at line 661 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::show_dag = false |
During simulation configuring, dump the contents of the DAG
Definition at line 622 of file SimulationConfiguration.hpp.
SignalMode sparta::app::SimulationConfiguration::signal_mode {SignalMode::ENABLE_BACKTRACE_SIGNALS} |
Signal configuration – enable signal catching or not. By default, SPARTA will catch all signals thrown by a running process. This can be difficult however, for EDA tools that install their own.
Definition at line 572 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::suppress_unread_parameter_warnings = false |
Suppress parameter unread warnings not the errors
Definition at line 627 of file SimulationConfiguration.hpp.
std::string sparta::app::SimulationConfiguration::trigger_clock |
The clock to set the trigger on if trigger_on_type is set to TRIGGER_ON_CYCLE
Definition at line 607 of file SimulationConfiguration.hpp.
TriggerSource sparta::app::SimulationConfiguration::trigger_on_type {TriggerSource::TRIGGER_ON_NONE} |
How to interpret the trigger_on_value number – cycle or instruction number
Definition at line 603 of file SimulationConfiguration.hpp.
uint64_t sparta::app::SimulationConfiguration::trigger_on_value = 0 |
Cycle count or instruction value to start the debugging
Definition at line 599 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::validate_post_run = false |
Should the simulator validate itself after running
Definition at line 612 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::verbose_cfg = false |
Show verbose messages while parsing input files (e.g. reports parameters).
Definition at line 549 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::verbose_report_triggers = false |
Show verbose report trigger messages
Definition at line 554 of file SimulationConfiguration.hpp.
bool sparta::app::SimulationConfiguration::warn_stderr = true |
Should log messages in the category log::categories::WARN be written to stderr
Definition at line 543 of file SimulationConfiguration.hpp.
std::string sparta::app::SimulationConfiguration::warnings_file {""} |
File to which warnings should be logged by default
Definition at line 617 of file SimulationConfiguration.hpp.