#include "options.hh" #include #include #include // verbose bool debug = false; bool print_task_tick = false; bool quiet = false; bool really_quiet = false; bool log_tick = false; bool latex = false; // critical system bool hard = false; bool fork_processes = false; bool wait_for_forked_processes = false; bool run = false; bool random_delay = true; std::string task_system = ""; // be-core bool poll_llc = false; bool do_freeze_BE_core = false; bool test_cgroup_overhead = false; int memory_budget_add_on = 0; void print_help_and_exit(char* program) { std::cerr << "Incorrect usage. This program has a man page." << std::endl; exit(EXIT_FAILURE); } static struct option const long_options[] = { {"debug", no_argument, NULL, 'd'}, {"fork-processes", no_argument, NULL, 'P'}, {"freeze-core", no_argument, NULL, 'f'}, {"hard", no_argument, NULL, 'h'}, {"no-random-delay", no_argument, NULL, 'i'}, {"log-tick", no_argument, NULL, 'l'}, {"memory-budget-add-on", required_argument, NULL, 'm'}, {"poll-llc", no_argument, NULL, 'p'}, {"quiet", no_argument, NULL, 'q'}, {"really-quiet", no_argument, NULL, 'Q'}, {"run", no_argument, NULL, 'r'}, {"system", required_argument, NULL, 's'}, {"test-cgroup-overhead", no_argument, NULL, 't'}, {"verbose", no_argument, NULL, 'v'}, {"wait", no_argument, NULL, 'w'}, {"latex", no_argument, NULL, 'x'}, {0, 0, 0, 0} }; void set_options(int argc, char* argv[]) { char* program = argv[0]; while (true) { int oi = -1; int c = getopt_long(argc, argv, "dhivQqrs:tlm:Ppfwx", long_options, &oi); if (c == -1) { break; } switch (c) { case 'i': random_delay = false; break; case 'd': debug = true; break; case 'f': do_freeze_BE_core = true; poll_llc = true; break; case 'h': hard = true; break; case 'l': log_tick = true; break; case 'v': print_task_tick = true; break; case 'Q': really_quiet = true; case 'q': quiet = true; break; case 'r': run = true; break; case 'p': poll_llc = true; break; case 'P': fork_processes = true; break; case 's': if (optarg) { task_system = optarg; } else { print_help_and_exit(program); } break; case 't': do_freeze_BE_core = true; poll_llc = true; test_cgroup_overhead = true; break; case 'm': if (optarg) { memory_budget_add_on = atoi(optarg); } else { print_help_and_exit(program); } break; case 'w': wait_for_forked_processes = true; fork_processes = true; break; case 'x': latex = true; break; default: print_help_and_exit(program); } } }