The Sparta Modeling Framework
Loading...
Searching...
No Matches
sparta::app::SimulationConfiguration Class Reference

Configuration applicator class that is used for configuring a simulator. Works in conjunction with sparta::app::Simulation. More...

#include <SimulationConfiguration.hpp>

Collaboration diagram for sparta::app::SimulationConfiguration:

Classes

class  SimDBConfig
 

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 ()
 
ParameterTreegetUnboundParameterTree ()
 
const ParameterTreegetUnboundParameterTree () const
 
ParameterTreegetArchUnboundParameterTree ()
 
const ParameterTreegetArchUnboundParameterTree () const
 
ParameterTreegetExtensionsUnboundParameterTree ()
 Returns a ParameterTree containing an unbound set of named tree node extensions and their parameter value(s).
 
const ParameterTreegetExtensionsUnboundParameterTree () 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.
 
const DefaultValuesgetDefaults () const
 Get the defaults this configuration was made with.
 
const log::TapDescVec & getTaps () const
 Get the taps vector.
 
void setConsumed () const
 

Public Attributes

bool warn_stderr = true
 
bool verbose_cfg = false
 
bool verbose_report_triggers = false
 
bool debug_sim = false
 
bool report_on_error = true
 
SignalMode signal_mode {SignalMode::ENABLE_BACKTRACE_SIGNALS}
 
AutoSummaryState auto_summary_state {AutoSummaryState::AUTO_SUMMARY_OFF}
 
PostRunDebugDumpPolicy debug_dump_policy {PostRunDebugDumpPolicy::DEBUG_DUMP_NEVER}
 
PostRunDebugDumpOptions debug_dump_options {PostRunDebugDumpOptions::DEBUG_DUMP_EVERYTHING}
 
std::string dump_debug_filename {"error-dump.dbg"}
 
uint64_t trigger_on_value = 0
 
TriggerSource trigger_on_type {TriggerSource::TRIGGER_ON_NONE}
 
std::string trigger_clock
 
bool validate_post_run = false
 
std::string warnings_file {""}
 
bool show_dag = false
 
bool suppress_unread_parameter_warnings = false
 
std::string pipeline_collection_file_prefix = NoPipelineCollectionStr
 
ReportDescVec reports
 
class sparta::app::SimulationConfiguration::SimDBConfig simdb_config
 
bool scheduler_exacting_run = false
 
bool scheduler_measure_run_time = true
 
std::string parsed_path_to_retired_inst_counter_
 
std::pair< std::string, app::DefaultValues::RetiredInstPathStrictnesspath_to_retired_inst_counter
 

Detailed Description

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.

Member Enumeration Documentation

◆ AutoSummaryState

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 372 of file SimulationConfiguration.hpp.

◆ PostRunDebugDumpOptions

Content of post-run debug dumping

Definition at line 363 of file SimulationConfiguration.hpp.

◆ PostRunDebugDumpPolicy

Behavior of post-run debug dumping

Enumerator
DEBUG_DUMP_ALWAYS 

Dump debug data in all cases after running.

DEBUG_DUMP_NEVER 

Never dump debug data after running.

DEBUG_DUMP_ERROR 

Dump debug data only if there is an error while running.

DEBUG_DUMP_MAX 

Invalid enum value.

Definition at line 353 of file SimulationConfiguration.hpp.

◆ SignalMode

Controls installation of signal handlers.

Definition at line 344 of file SimulationConfiguration.hpp.

◆ TriggerSource

Type of trigger to create using trigger_on_value for enabling pipeout collection, logging, and pevents

Definition at line 383 of file SimulationConfiguration.hpp.

Member Function Documentation

◆ addArchSearchPath()

void sparta::app::SimulationConfiguration::addArchSearchPath ( const std::string & dir)
inline

Append to the front of the architectural directory paths list the given directory

Definition at line 290 of file SimulationConfiguration.hpp.

◆ addConfigSearchPath()

void sparta::app::SimulationConfiguration::addConfigSearchPath ( const std::string & dir)
inline

Append to the front of the configuration directory path list the given directory

Definition at line 306 of file SimulationConfiguration.hpp.

◆ addReportDefnSearchPath()

void sparta::app::SimulationConfiguration::addReportDefnSearchPath ( const std::string & dir)
inline

Append to the front of the report definitions directory path list the given directory

Definition at line 322 of file SimulationConfiguration.hpp.

◆ archFileProvided()

bool sparta::app::SimulationConfiguration::archFileProvided ( ) const
inline

Was an arch file provided in this configuration?

Definition at line 274 of file SimulationConfiguration.hpp.

◆ copyTreeNodeExtensionsFromArchAndConfigPTrees()

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.

◆ disablePrettyPrintReports()

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

◆ enableLogging()

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

◆ getArchSearchPath()

const std::vector< std::string > & sparta::app::SimulationConfiguration::getArchSearchPath ( ) const
inline

Get the arch search paths.

Returns
A vector of strings of the search paths

Definition at line 298 of file SimulationConfiguration.hpp.

◆ getArchUnboundParameterTree() [1/2]

ParameterTree & sparta::app::SimulationConfiguration::getArchUnboundParameterTree ( )
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.

◆ getArchUnboundParameterTree() [2/2]

const ParameterTree & sparta::app::SimulationConfiguration::getArchUnboundParameterTree ( ) const
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.

◆ getConfigSearchPath()

const std::vector< std::string > & sparta::app::SimulationConfiguration::getConfigSearchPath ( ) const
inline

Get the search paths for the configure files.

Returns
A vector of strings of the search paths

Definition at line 314 of file SimulationConfiguration.hpp.

◆ getDefaults()

const DefaultValues & sparta::app::SimulationConfiguration::getDefaults ( ) const
inline

Get the defaults this configuration was made with.

Definition at line 598 of file SimulationConfiguration.hpp.

◆ getExtensionsUnboundParameterTree() [1/2]

ParameterTree & sparta::app::SimulationConfiguration::getExtensionsUnboundParameterTree ( )
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.

◆ getExtensionsUnboundParameterTree() [2/2]

const ParameterTree & sparta::app::SimulationConfiguration::getExtensionsUnboundParameterTree ( ) const
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.

◆ getFinalConfigFile()

std::string sparta::app::SimulationConfiguration::getFinalConfigFile ( ) const
inline

Get the final config file name.

Definition at line 184 of file SimulationConfiguration.hpp.

◆ getReportDefnSearchPaths()

const std::vector< std::string > & sparta::app::SimulationConfiguration::getReportDefnSearchPaths ( ) const
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.

◆ getTaps()

const log::TapDescVec & sparta::app::SimulationConfiguration::getTaps ( ) const
inline

Get the taps vector.

Definition at line 601 of file SimulationConfiguration.hpp.

◆ getUnboundParameterTree() [1/2]

ParameterTree & sparta::app::SimulationConfiguration::getUnboundParameterTree ( )
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.

◆ getUnboundParameterTree() [2/2]

const ParameterTree & sparta::app::SimulationConfiguration::getUnboundParameterTree ( ) const
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.

◆ hasFinalConfig()

bool sparta::app::SimulationConfiguration::hasFinalConfig ( ) const
inline

Was a final configuration file provided?

Definition at line 156 of file SimulationConfiguration.hpp.

◆ omitStatsWithValueZeroForReportFormat()

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".

◆ printArchConfigurations()

void sparta::app::SimulationConfiguration::printArchConfigurations ( std::ostream & os) const
inline

Print the ArchNodeConfigFileApplicator for informative messages.

Definition at line 277 of file SimulationConfiguration.hpp.

Here is the call graph for this function:

◆ printGenericConfigurations()

void sparta::app::SimulationConfiguration::printGenericConfigurations ( std::ostream & os) const
inline

Print the generic configurations for informative messages.

Definition at line 335 of file SimulationConfiguration.hpp.

◆ processArch()

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

◆ processConfigFile()

void sparta::app::SimulationConfiguration::processConfigFile ( const std::string & pattern,
const std::string & filename,
bool is_final = false )

Consume a configuration (.yaml) file

Parameters
patternThe node to apply the given yaml file. Use "" for top
filenameThe yaml file to consume
is_finalIs this a final configuration file

◆ processParameter()

void sparta::app::SimulationConfiguration::processParameter ( const std::string & pattern,
const std::string & value,
bool optional = false )

Handle an individual parameter

Parameters
patternThe path to the parameter node to modify
valueThe value to be written
ignoreIs this an optional parameter?

◆ setConsumed()

void sparta::app::SimulationConfiguration::setConsumed ( ) const
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 606 of file SimulationConfiguration.hpp.

Member Data Documentation

◆ auto_summary_state

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 430 of file SimulationConfiguration.hpp.

◆ debug_dump_options

PostRunDebugDumpOptions sparta::app::SimulationConfiguration::debug_dump_options {PostRunDebugDumpOptions::DEBUG_DUMP_EVERYTHING}

Debug dumping options

Definition at line 440 of file SimulationConfiguration.hpp.

◆ debug_dump_policy

PostRunDebugDumpPolicy sparta::app::SimulationConfiguration::debug_dump_policy {PostRunDebugDumpPolicy::DEBUG_DUMP_NEVER}

Debug dumping policy

Definition at line 435 of file SimulationConfiguration.hpp.

◆ debug_sim

bool sparta::app::SimulationConfiguration::debug_sim = false

Should simulator-framework debug messages be written

Definition at line 410 of file SimulationConfiguration.hpp.

◆ dump_debug_filename

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 445 of file SimulationConfiguration.hpp.

◆ parsed_path_to_retired_inst_counter_

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 592 of file SimulationConfiguration.hpp.

◆ path_to_retired_inst_counter

std::pair<std::string, app::DefaultValues::RetiredInstPathStrictness> sparta::app::SimulationConfiguration::path_to_retired_inst_counter
Initial value:
=
std::make_pair(defaults_.path_to_retired_inst_counter.first,
app::DefaultValues::RetiredInstPathStrictness::Relaxed)

Definition at line 593 of file SimulationConfiguration.hpp.

◆ pipeline_collection_file_prefix

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 484 of file SimulationConfiguration.hpp.

◆ report_on_error

bool sparta::app::SimulationConfiguration::report_on_error = true

Write reports o error

Definition at line 415 of file SimulationConfiguration.hpp.

◆ reports

ReportDescVec sparta::app::SimulationConfiguration::reports

Additional report descriptions

Definition at line 489 of file SimulationConfiguration.hpp.

◆ scheduler_exacting_run

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:

  1. It can advance the internal ticks and elapsed_tick counts by the exact amount regardless of whether it has work to do.
  2. It can ignore the amount of time to advance and just return.

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 580 of file SimulationConfiguration.hpp.

◆ scheduler_measure_run_time

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 588 of file SimulationConfiguration.hpp.

◆ show_dag

bool sparta::app::SimulationConfiguration::show_dag = false

During simulation configuring, dump the contents of the DAG

Definition at line 473 of file SimulationConfiguration.hpp.

◆ signal_mode

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 423 of file SimulationConfiguration.hpp.

◆ suppress_unread_parameter_warnings

bool sparta::app::SimulationConfiguration::suppress_unread_parameter_warnings = false

Suppress parameter unread warnings not the errors

Definition at line 478 of file SimulationConfiguration.hpp.

◆ trigger_clock

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 458 of file SimulationConfiguration.hpp.

◆ trigger_on_type

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 454 of file SimulationConfiguration.hpp.

◆ trigger_on_value

uint64_t sparta::app::SimulationConfiguration::trigger_on_value = 0

Cycle count or instruction value to start the debugging

Definition at line 450 of file SimulationConfiguration.hpp.

◆ validate_post_run

bool sparta::app::SimulationConfiguration::validate_post_run = false

Should the simulator validate itself after running

Definition at line 463 of file SimulationConfiguration.hpp.

◆ verbose_cfg

bool sparta::app::SimulationConfiguration::verbose_cfg = false

Show verbose messages while parsing input files (e.g. reports parameters).

Definition at line 400 of file SimulationConfiguration.hpp.

◆ verbose_report_triggers

bool sparta::app::SimulationConfiguration::verbose_report_triggers = false

Show verbose report trigger messages

Definition at line 405 of file SimulationConfiguration.hpp.

◆ warn_stderr

bool sparta::app::SimulationConfiguration::warn_stderr = true

Should log messages in the category log::categories::WARN be written to stderr

Definition at line 394 of file SimulationConfiguration.hpp.

◆ warnings_file

std::string sparta::app::SimulationConfiguration::warnings_file {""}

File to which warnings should be logged by default

Definition at line 468 of file SimulationConfiguration.hpp.


The documentation for this class was generated from the following file: