X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/blobdiff_plain/5279f43fc9be71815091e79c76d5bc04c8c88421..4f8948b8f67d26726a2e53c9afe1a110c037ce4b:/options.cpp diff --git a/options.cpp b/options.cpp index 18d4613..61861f0 100644 --- a/options.cpp +++ b/options.cpp @@ -1,10 +1,11 @@ +#include "options.h" + #include // strrchr #include #include #include #include // getopt #include -#include "options.h" #include "misc.h" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(simu); @@ -19,6 +20,8 @@ namespace opt { int help_requested = 0; bool version_requested = false; + unsigned log_rate = 1; + unsigned maxiter = 4; bool exit_on_close = false; @@ -46,7 +49,7 @@ int opt::parse_args(int* argc, char* argv[]) int c; opterr = 0; - while ((c = getopt(*argc, argv, "bc:ehi:V")) != -1) { + while ((c = getopt(*argc, argv, "bc:ehi:l:V")) != -1) { switch (c) { case 'b': opt::bookkeeping = true; @@ -63,6 +66,9 @@ int opt::parse_args(int* argc, char* argv[]) case 'i': std::istringstream(optarg) >> opt::maxiter; break; + case 'l': + std::istringstream(optarg) >> opt::log_rate; + break; case 'V': opt::version_requested = true; break; @@ -103,6 +109,7 @@ void opt::print() INFO0(",----[ Simulation parameters ]"); INFO1("| platform_file.......: \"%s\"", opt::platform_file); INFO1("| application_file....: \"%s\"", opt::application_file); + INFO1("| log rate............: %u", opt::log_rate); INFO1("| maxiter.............: %u", opt::maxiter); INFO1("| exit on close.......: %s", on_off(opt::exit_on_close)); INFO1("| bookkeeping.........: %s", on_off(opt::bookkeeping)); @@ -137,6 +144,9 @@ void opt::usage() std::clog << oo("-i", "value") << "maximum number of iterations, 0 for infinity (" << opt::maxiter << ")\n"; + std::clog << oo("-l", "value") + << "print current load every \"value\" iterations, 0 to disable (" + << opt::log_rate << ")\n"; #undef o #undef oo