|
CohereSim: A Bus-based Cache Simulator
v3.3
A tool for education in computing - learn about coherence protocols, replacement policies, and SMP vs DSM
|
This file processes the command line arguments, provides helper methods for processing the command line arguments, and decides what to run. More...

Macros | |
| #define | NO_ARGS 1 |
| The value of 'argc' if no arguments were passed on the command line. | |
| #define | NUM_COLUMNS (N_STATISTICS + 3) |
| The number of columns that appear in the output statistics. | |
| #define | CONFIG_LINE_SIZE (ARG_C_COUNT * 10) |
| The size of the config line buffer. | |
Functions | |
| void | exitIf (bool condition, std::string msg, uint32_t config_id, uint32_t arg_index) |
| Provide error message and exit code on condition. More... | |
| void | getConfig (int argc, char *argv[], cache_config &config) |
| Parse the given arguments into a memory system configuration. More... | |
| size_t | getTrace (int argc, char *argv[], std::ifstream &trace_file, int arg_max_count) |
| Open the trace file and read the trace limit. More... | |
| void | readConfigurations (std::vector< cache_config > &configs, char *configs_file_path) |
| Parse the cache configurations from the given configs file. More... | |
| void | printStatsHeader () |
| Print the header row in the statistics output CSV. | |
| void | usageMsg () |
| Print the program usage method. | |
| int | main (int argc, char *argv[]) |
| The main function decides which mode to execute based on the number of arguments supplied. More... | |
Variables | |
| std::map< std::string, coh_factory_t, ci_less > * | coherence_map = nullptr |
| A map from coherence protocol names to their factory functions. | |
| std::map< std::string, dir_factory_t, ci_less > * | directory_map = nullptr |
| A map from directory protocol names to their factory functions. | |
| std::map< std::string, rep_factory_t, ci_less > * | replacement_map = nullptr |
| A map from replacement policy names to their factory functions. | |
| constexpr const char * | stat_names [NUM_COLUMNS] |
| CSV-friendly names for cache runtime statistics. Make sure these match up with 'bus_msg_e' and 'statistic_e'. More... | |
This file processes the command line arguments, provides helper methods for processing the command line arguments, and decides what to run.
| void exitIf | ( | bool | condition, |
| std::string | msg, | ||
| uint32_t | config_id, | ||
| uint32_t | arg_index | ||
| ) |
Provide error message and exit code on condition.
| condition | Whether the program should print an error message and exit |
| msg | The error message to print |
| config_id | The ID of the config that caused the error |
| arg_index | The argument of the config that caused the error |
| void getConfig | ( | int | argc, |
| char * | argv[], | ||
| cache_config & | config | ||
| ) |
Parse the given arguments into a memory system configuration.
| argc | The number of program arguments |
| argv | The array of program arguments |
| config | The configuration struct to populate |
| size_t getTrace | ( | int | argc, |
| char * | argv[], | ||
| std::ifstream & | trace_file, | ||
| int | arg_max_count | ||
| ) |
Open the trace file and read the trace limit.
| argc | The number of program arguments |
| argv | The array of program arguments |
| trace_file | An ifstream that will become the trace file |
| arg_max_count | The number of arguments when the trace limit argument is present |
| int main | ( | int | argc, |
| char * | argv[] | ||
| ) |
The main function decides which mode to execute based on the number of arguments supplied.
| argc | The number of command line arguments |
| argv | An array to the command line arguments |
| void readConfigurations | ( | std::vector< cache_config > & | configs, |
| char * | configs_file_path | ||
| ) |
Parse the cache configurations from the given configs file.
| configs | The vector to contain the configurations |
| configs_file_path | The file path to the configs file |
|
constexpr |
CSV-friendly names for cache runtime statistics. Make sure these match up with 'bus_msg_e' and 'statistic_e'.