X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/147d0e88c4da14c801d15e0875bedb474180bea2..f4125505064e3ff346b31ab9e48f894672e5a7a7:/options.cpp?ds=inline diff --git a/options.cpp b/options.cpp index 24ae952..4dd5315 100644 --- a/options.cpp +++ b/options.cpp @@ -17,29 +17,39 @@ namespace opt { int help_requested = 0; bool version_requested = false; + bool bookkeeping = false; + cost_func comp_cost("1e9, 0"); // fixme: find better defaults - cost_func comm_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; @@ -74,8 +84,8 @@ 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