mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: make format of ExecutionTime = ... output configurable (issue #788)
- controlled by the the 'printExecutionFormat' InfoSwitch in
etc/controlDict
// Style for "ExecutionTime = " output
// - 0 = seconds (with trailing 's')
// - 1 = day-hh:mm:ss
ExecutionTime = 112135.2 s ClockTime = 113017 s
ExecutionTime = 1-07:08:55.20 ClockTime = 1-07:23:37
- Callable via the new Time::printExecutionTime() method,
which also helps to reduce clutter in the applications.
Eg,
runTime.printExecutionTime(Info);
vs
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
--
ENH: return elapsedClockTime() and clockTimeIncrement as double
- previously returned as time_t, which is less portable.
This commit is contained in:
@ -30,6 +30,7 @@ License
|
||||
#include "profiling.H"
|
||||
#include "demandDrivenData.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "registerSwitch.H"
|
||||
|
||||
#include <sstream>
|
||||
|
||||
@ -77,6 +78,19 @@ const int Foam::Time::maxPrecision_(3 - log10(SMALL));
|
||||
|
||||
Foam::word Foam::Time::controlDictName("controlDict");
|
||||
|
||||
int Foam::Time::printExecutionFormat_
|
||||
(
|
||||
Foam::debug::infoSwitch("printExecutionFormat", 0)
|
||||
);
|
||||
|
||||
|
||||
registerInfoSwitch
|
||||
(
|
||||
"printExecutionFormat",
|
||||
int,
|
||||
Foam::Time::printExecutionFormat_
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -1161,7 +1175,7 @@ Foam::Time& Foam::Time::operator++()
|
||||
{
|
||||
const label writeIndex = label
|
||||
(
|
||||
returnReduce(label(elapsedClockTime()), maxOp<label>())
|
||||
returnReduce(elapsedClockTime(), maxOp<double>())
|
||||
/ writeInterval_
|
||||
);
|
||||
if (writeIndex > writeTimeIndex_)
|
||||
|
||||
Reference in New Issue
Block a user