ENH: support '-profiling' command-line option

- this option overrides any controlDict settings as a convenient means
  to selecting profiling without messing with the controlDict.

- provide Profiling::writeNow() to emit profiling for utilities that
  don't have any natural time increment mechanism to trigger it.
This commit is contained in:
Mark Olesen
2016-06-17 23:45:03 +02:00
parent 2dc31390df
commit be73d81a22
5 changed files with 70 additions and 22 deletions

View File

@ -334,11 +334,17 @@ void Foam::Time::setControls()
}
void Foam::Time::setMonitoring()
void Foam::Time::setMonitoring(bool forceProfiling)
{
// initialize profiling on request
// skip if 'active' keyword is explicitly set to false
const dictionary* profilingDict = controlDict_.subDictPtr("profiling");
const dictionary* profilingDict =
(
forceProfiling
? &dictionary::null
: controlDict_.subDictPtr("profiling")
);
if
(
profilingDict
@ -526,7 +532,9 @@ Foam::Time::Time
readOpt() = IOobject::MUST_READ_IF_MODIFIED;
setControls();
setMonitoring();
// '-profiling' = force profiling, ignore controlDict entry
setMonitoring(args.optionFound("profiling"));
}