21#include "sparta/sparta.hpp"
22#include "sparta/simulation/ParameterTree.hpp"
24#include "sparta/log/Tap.hpp"
33constexpr char NoPipelineCollectionStr[] =
"NOPREFIX_";
100 std::pair<std::string, RetiredInstPathStrictness> path_to_retired_inst_counter =
101 std::make_pair(
"rob.stats.total_number_retired",
102 RetiredInstPathStrictness::Relaxed);
135 bool optional =
false);
142 bool is_final =
false);
147 const std::string & filename);
152 const std::string & category,
153 const std::string & destination);
175 const std::string & value);
214 const std::set<utils::lowercase_string> &
259 return extensions_ptree_;
268 return extensions_ptree_;
279 os << arch_applicator_->stringize();
282 os <<
"<not provided>";
291 arch_search_paths_.emplace(arch_search_paths_.begin(), dir);
299 return arch_search_paths_;
307 config_search_paths_.emplace(config_search_paths_.begin(), dir);
315 return config_search_paths_;
323 report_defn_search_paths_.emplace(report_defn_search_paths_.begin(), dir);
331 return report_defn_search_paths_;
336 for(
auto & cp : config_applicators_) {
337 os <<
" " << cp->stringize() <<
'\n';
346 DISABLE_BACKTRACE_SIGNALS,
347 ENABLE_BACKTRACE_SIGNALS
364 DEBUG_DUMP_EVERYTHING,
366 DEBUG_DUMP_BACKTRACE_ONLY
386 TRIGGER_ON_INSTRUCTION,
497 void disableLegacyReports()
499 if (!appEnabled(
"simdb-reports")) {
501 <<
"Cannot disable legacy reports when simdb-reports app is not enabled";
503 legacy_reports_enabled_ =
false;
506 bool legacyReportsEnabled()
const
508 return legacy_reports_enabled_;
511 void enableApp(
const std::string & app_name,
const std::string & db_file)
513 enabled_apps_[db_file].insert(app_name);
514 app_db_files_[app_name].insert(db_file);
517 bool appEnabled(
const std::string & app_name)
const
519 return app_db_files_.count(app_name) > 0;
522 std::vector<std::string> getEnabledApps()
const
524 std::vector<std::string> apps;
525 for (
const auto& [app_name, db_files] : app_db_files_)
527 apps.emplace_back(app_name);
532 std::vector<std::string> getAppDatabases(
const std::string & app_name)
const
534 auto it = app_db_files_.find(app_name);
535 if (it != app_db_files_.end()) {
536 return {it->second.begin(), it->second.end()};
544 void addPragmaOnOpen(
const std::string& name,
const std::string& val)
546 dbmgr_pragmas_[name] = val;
549 std::vector<std::pair<std::string, std::string>> getPragmas()
const
551 std::vector<std::pair<std::string, std::string>> pragmas;
552 for (
const auto & [name, val] : dbmgr_pragmas_)
554 pragmas.emplace_back(name, val);
560 std::string simdb_file_;
561 std::map<std::string, std::set<std::string>> enabled_apps_;
562 std::map<std::string, std::set<std::string>> app_db_files_;
563 bool legacy_reports_enabled_ =
true;
564 std::map<std::string, std::string> dbmgr_pragmas_;
593 std::pair<std::string, app::DefaultValues::RetiredInstPathStrictness> path_to_retired_inst_counter =
594 std::make_pair(defaults_.path_to_retired_inst_counter.first,
595 app::DefaultValues::RetiredInstPathStrictness::Relaxed);
601 const log::TapDescVec &
getTaps()
const {
return taps_; }
611 mutable bool is_consumed_ =
false;
617 std::string final_config_file_ =
"";
620 std::string memory_usage_def_file_;
624 bool generate_stats_mapping_ =
false;
628 std::set<std::string> disabled_pretty_print_report_formats_;
632 std::set<utils::lowercase_string> zero_values_omitted_report_formats_;
644 std::vector<std::string> arch_search_paths_;
647 std::vector<std::string> config_search_paths_ = {
"./"};
650 std::vector<std::string> report_defn_search_paths_;
653 std::set<std::string> simulation_control_filenames_;
656 std::vector<std::pair<std::string, std::string>> run_metadata_;
659 std::unique_ptr<ArchNodeConfigFileApplicator> arch_applicator_;
662 ConfigVec config_applicators_;
672 log::TapDescVec taps_;
675 std::string state_tracking_file_;
Configuration Applicators.
Describes reports to instantiate and tracks their instantiations.
Set of macros for Sparta assertions. Caught by the framework.
Virtual Parameter Tree. This represents a tree of parameters read from some source but does not neces...
Used to construct and throw a standard C++ exception. Inherits from std::exception.
Optional default values for the simulator which can be customized and provided by anyone instantiatin...
std::string arch_arg_default
bool non_empty_arch_arg_required
std::string run_time_clock
RetiredInstPathStrictness
std::list< ParameterTemplate > other_meta_params
std::vector< std::string > arch_search_dirs
std::string auto_summary_default
Configuration applicator class that is used for configuring a simulator. Works in conjunction with sp...
const DefaultValues & getDefaults() const
Get the defaults this configuration was made with.
const std::vector< std::string > & getArchSearchPath() const
Get the arch search paths.
std::string parsed_path_to_retired_inst_counter_
PostRunDebugDumpOptions debug_dump_options
std::string getFinalConfigFile() const
Get the final config file name.
const std::vector< std::string > & getReportDefnSearchPaths() const
bool hasFinalConfig() const
Was a final configuration file provided?
void omitStatsWithValueZeroForReportFormat(const std::string &format)
const std::vector< std::pair< std::string, std::string > > & getRunMetadata() const
Get run metadata as key-value pairs.
void processExtensionFile(const std::string &filename)
Consume an extension (.yaml) file.
void addReportDefnSearchPath(const std::string &dir)
const std::string & getStateTrackingFilename() const
Get the State Tracking filename.
ParameterTree & getUnboundParameterTree()
const ParameterTree & getArchUnboundParameterTree() const
const std::set< std::string > & getDisabledPrettyPrintFormats() const
Get all report file extensions which have had their pretty printing disabled.
bool scheduler_exacting_run
void printArchConfigurations(std::ostream &os) const
Print the ArchNodeConfigFileApplicator for informative messages.
bool suppress_unread_parameter_warnings
void processConfigFile(const std::string &pattern, const std::string &filename, bool is_final=false)
bool verbose_report_triggers
void addRunMetadata(const std::string &name, const std::string &value)
Add run metadata as a string.
const std::vector< std::string > & getConfigSearchPath() const
Get the search paths for the configure files.
std::string dump_debug_filename
void printGenericConfigurations(std::ostream &os) const
Print the generic configurations for informative messages.
const std::set< utils::lowercase_string > & getReportFormatsWhoOmitStatsWithValueZero() const
Get all report formats which are to omit all SI values that are zero.
void copyTreeNodeExtensionsFromArchAndConfigPTrees()
void setMemoryUsageDefFile(const std::string &def_file)
Set filename which contains heap profiler settings.
void addConfigSearchPath(const std::string &dir)
bool archFileProvided() const
SignalMode
Controls installation of signal handlers.
void addControlFile(const std::string &filename)
Consume a simulation control file.
const std::string & getMemoryUsageDefFile() const
Get filename for heap profiler configuration.
SimulationConfiguration(const DefaultValues &defaults=DefaultValues())
Create a SimulationConfiguration.
PostRunDebugDumpPolicy debug_dump_policy
bool shouldGenerateStatsMapping() const
Get statistics mapping "enabled" flag.
std::string stringizeRunMetadata() const
Get run metadata stringized as "name1=value1,name2=value2,...".
ParameterTree & getArchUnboundParameterTree()
void addArchSearchPath(const std::string &dir)
TriggerSource trigger_on_type
void disablePrettyPrintReports(const std::string &format)
const log::TapDescVec & getTaps() const
Get the taps vector.
const ParameterTree & getUnboundParameterTree() const
AutoSummaryState auto_summary_state
std::string pipeline_collection_file_prefix
std::string trigger_clock
void setStateTrackingFile(const std::string &filename)
Set the filename for the State Tracking file.
const ParameterTree & getExtensionsUnboundParameterTree() const
Returns a ParameterTree (const version) containing an unbound set of named tree node extensions and t...
void enableLogging(const std::string &pattern, const std::string &category, const std::string &destination)
@ AUTO_SUMMARY_VERBOSE
Write verbose summary.
@ AUTO_SUMMARY_OFF
Do not write summary.
@ AUTO_SUMMARY_NORMAL
Write normal summary.
@ AUTO_SUMMARY_MAX
Invalid enum value.
@ 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_ALWAYS
Dump debug data in all cases after running.
@ DEBUG_DUMP_MAX
Invalid enum value.
void generateStatsMapping()
Auto-generate mappings from report column headers to statistic names.
void processParameter(const std::string &pattern, const std::string &value, bool optional=false)
ParameterTree & getExtensionsUnboundParameterTree()
Returns a ParameterTree containing an unbound set of named tree node extensions and their parameter v...
bool scheduler_measure_run_time
const std::set< std::string > & getControlFiles() const
Get all control files for this simulation.
std::string warnings_file
uint64_t trigger_on_value
void processArch(const std::string &pattern, const std::string &filename)
Macros for handling exponential backoff.