From 27a8b3b70ed93e45f17e9792d0a23ea781b2b4dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= <stepan@adjemian.eu> Date: Wed, 1 Apr 2020 19:54:45 +0200 Subject: [PATCH] Added preprocessor option: notime. Do not print the total computing time at the end of the driver. --- src/DynareMain.cc | 7 +++++-- src/ModFile.cc | 11 ++++++----- src/ModFile.hh | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/DynareMain.cc b/src/DynareMain.cc index 73a1319e..a03a386c 100644 --- a/src/DynareMain.cc +++ b/src/DynareMain.cc @@ -57,7 +57,7 @@ usage() << " [-D<variable>[=<value>]] [-I/path] [nostrict] [stochastic] [fast] [minimal_workspace] [compute_xrefs] [output=dynamic|first|second|third] [language=matlab|julia]" << " [params_derivs_order=0|1|2] [transform_unary_ops] [exclude_eqs=<equation_tag_list_or_file>] [include_eqs=<equation_tag_list_or_file>]" << " [json=parse|check|transform|compute] [jsonstdout] [onlyjson] [jsonderivsimple] [nopathchange] [nopreprocessoroutput]" - << " [mexext=<extension>] [matlabroot=<path>] [onlymodel]" + << " [mexext=<extension>] [matlabroot=<path>] [onlymodel] [notime]" << endl; exit(EXIT_FAILURE); } @@ -123,6 +123,7 @@ main(int argc, char **argv) options.emplace_back(argv[arg]); // Parse options + bool notime = false; bool clear_all = true; bool clear_global = false; bool save_macro = false; @@ -170,6 +171,8 @@ main(int argc, char **argv) { if (s == "debug") debug = true; + else if (s == "notime") + notime = true; else if (s == "noclearall") clear_all = false; else if (s.substr(0, 19) == "params_derivs_order") @@ -479,7 +482,7 @@ main(int argc, char **argv) else mod_file->writeOutputFiles(basename, clear_all, clear_global, no_log, no_warn, console, nograph, nointeractive, config_file, check_model_changes, minimal_workspace, compute_xrefs, - mexext, matlabroot, dynareroot, onlymodel, gui); + mexext, matlabroot, dynareroot, onlymodel, gui, notime); cout << "Preprocessing completed." << endl; return EXIT_SUCCESS; diff --git a/src/ModFile.cc b/src/ModFile.cc index a59a8ab0..6c6e5bfa 100644 --- a/src/ModFile.cc +++ b/src/ModFile.cc @@ -840,7 +840,7 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo bool check_model_changes, bool minimal_workspace, bool compute_xrefs, const string &mexext, const filesystem::path &matlabroot, - const filesystem::path &dynareroot, bool onlymodel, bool gui) const + const filesystem::path &dynareroot, bool onlymodel, bool gui, bool notime) const { bool hasModelChanged = !dynamic_model.isChecksumMatching(basename, block) || !check_model_changes; if (hasModelChanged) @@ -1098,10 +1098,11 @@ ModFile::writeOutputFiles(const string &basename, bool clear_all, bool clear_glo << " save('" << basename << "_results.mat', 'oo_recursive_', '-append');" << endl << "end" << endl; config_file.writeEndParallel(mOutputFile); - - mOutputFile << endl << endl - << "disp(['Total computing time : ' dynsec2hms(toc(tic0)) ]);" << endl; - + if (!notime) + { + mOutputFile << endl << endl + << "disp(['Total computing time : ' dynsec2hms(toc(tic0)) ]);" << endl; + } if (!no_warn) { if (warnings.countWarnings() > 0) diff --git a/src/ModFile.hh b/src/ModFile.hh index ae53b468..0ff5223f 100644 --- a/src/ModFile.hh +++ b/src/ModFile.hh @@ -168,7 +168,7 @@ public: bool console, bool nograph, bool nointeractive, const ConfigFile &config_file, bool check_model_changes, bool minimal_workspace, bool compute_xrefs, const string &mexext, const filesystem::path &matlabroot, - const filesystem::path &dynareroot, bool onlymodel, bool gui) const; + const filesystem::path &dynareroot, bool onlymodel, bool gui, bool notime) const; void writeExternalFiles(const string &basename, LanguageOutputType language) const; void writeExternalFilesJulia(const string &basename) const; -- GitLab