X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/d47d44b2ed067c834ef210ad544512e7581a1c8e..f4125505064e3ff346b31ab9e48f894672e5a7a7:/options.cpp diff --git a/options.cpp b/options.cpp index aa3bede..4dd5315 100644 --- a/options.cpp +++ b/options.cpp @@ -17,29 +17,39 @@ namespace opt { int help_requested = 0; bool version_requested = false; - cost_func comp_cost("1, 0"); - cost_func comm_cost("1, 0"); + bool bookkeeping = false; + + cost_func comp_cost("1e9, 0"); // fixme: find better defaults } // namespace opt +namespace { + + const char* on_off(bool b) + { + return b ? "on" : "off"; + } + +} + int opt::parse_args(int* argc, char* argv[]) { - char *tmp = strrchr(argv[0], '/'); + char* tmp = strrchr(argv[0], '/'); opt::program_name = (tmp ? tmp + 1 : argv[0]); int c; opterr = 0; - while ((c = getopt(*argc, argv, "hc:C:V")) != -1) { + while ((c = getopt(*argc, argv, "bc:hV")) != -1) { switch (c) { + case 'b': + opt::bookkeeping = true; + break; case 'h': opt::help_requested++; break; case 'c': opt::comp_cost = cost_func(optarg); break; - case 'C': - opt::comm_cost = cost_func(optarg); - break; case 'V': opt::version_requested = true; break; @@ -68,14 +78,14 @@ int opt::parse_args(int* argc, char* argv[]) return 1; } - + void opt::print() { INFO0(",----[ Simulation parameters ]"); INFO1("| platform_file.......: \"%s\"", opt::platform_file); INFO1("| application_file....: \"%s\"", opt::application_file); - INFO1("| comp. cost factors..: [%s]", opt::comp_cost.to_string().c_str()); - INFO1("| comm. cost factors..: [%s]", opt::comm_cost.to_string().c_str()); + INFO1("| bookkeeping.........: %s", on_off(opt::bookkeeping)); + INFO1("| comp. cost factors..: [%s]", opt::comp_cost.to_string().c_str()); INFO0("`----"); } @@ -97,12 +107,10 @@ void opt::usage() if (opt::help_requested < 1) return; std::clog << o("-V") << "print version and exit\n"; + std::clog << o("-b") << "activate bookkeeping\n"; std::clog << oo("-c", "[fn,...]f0") << "polynomial factors for computation cost (" << opt::comp_cost.to_string() << ")\n"; - std::clog << oo("-C", "[fn,...]f0") - << "polynomial factors for communication cost (" - << opt::comm_cost.to_string() << ")\n"; #undef o #undef oo