90int main(
int argc,
char* argv[]) {
94 std::cerr <<
"Error: " << error <<
'\n';
105 std::cerr <<
"Error: " << error <<
'\n';
110 std::ofstream logFile;
114 std::cerr <<
"Error: cannot write " << config.
logPath <<
".events.txt\n";
119 std::cerr <<
"Error: cannot write " << config.
logPath <<
'\n';
129 if (logFile.is_open()) {
131 std::cout <<
"\nLog summary written to " << config.
logPath <<
'\n';
void promptForSettings(Config &config, std::istream &in, std::ostream &out)
Asks the user for the main settings, keeping the current value when the answer is blank.
bool validateConfig(const Config &config, std::string &error)
Checks that the settings are consistent.
void printUsage(std::ostream &out, const std::string &program)
Prints the list of command-line options.
bool parseArguments(int argc, char *argv[], Config &config, std::string &error)
Reads command-line options into a Config.
Declares the Config structure and the command-line and interactive input functions.
Declares the Logger class that prints colored, mode-aware simulation events.
Declares the Simulation class, which drives the clock and writes the run log.
Writes simulation events to the console and, optionally, to a file.
bool openEventFile(const std::string &path)
Copies events to a file in addition to the console.
Owns one complete run: the generator, the load balancer(s) and the clock.
void writeReport(std::ostream &out) const
Writes the full log summary: settings, randomness, results, snapshots and scaling timeline.
void run()
Runs every clock cycle of the simulation.
int main(int argc, char *argv[])
Parses input, runs the simulation and writes the summary to the console and log file.
Every user-adjustable setting for one simulation run.
std::string logPath
File for the run summary (and events in verbose mode).
bool verbose
Print every event instead of only status lines.
bool color
Use ANSI colors on a terminal.
bool showHelp
Print usage and exit.
bool interactive
Ask for the main settings on standard input.