namespace opt {
+ // Constants
+
+ // A sum of loads if considered null if it is less than
+ // load_ratio_threshold percent of the sum of loads at init.
+ const double load_ratio_threshold = 1e-4;
+
// Global options
std::string program_name;
int help_requested = 0;
} // namespace opt
-int opt::parse_args(int* argc, char* argv[])
+bool opt::parse_args(int* argc, char* argv[])
{
- int result = 1;
+ bool result = true;
opt::program_name = argv[0];
opt::program_name.erase(0, 1 + opt::program_name.find_last_of('/'));
if (!opt::loba_algorithms.exists(opt::loba_algo)) {
ERROR1("unknownw load balancing algorithm -- %s",
opt::loba_algo.c_str());
- result = 0;
+ result = false;
}
break;
case 'b':
if (!opt::topologies.exists(opt::auto_depl::topology)) {
ERROR1("unknownw topology -- %s",
opt::auto_depl::topology.c_str());
- result = 0;
+ result = false;
}
break;
case 'v':
break;
case '?':
ERROR1("invalid option -- '%c'", optopt);
- result = 0;
+ result = false;
break;
}
}
opt::platform_file = argv[optind++];
} else {
ERROR0("missing parameter -- <plaform_file>");
- result = 0;
+ result = false;
}
if (optind < *argc) {
opt::deployment_file = argv[optind++];
while (optind < *argc) {
ERROR1("unused parameter -- \"%s\"", argv[optind++]);
- result = 0;
+ result = false;
}
return result;