From b287d1bdddcb2336156528fb215ea4b0e56d2461 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 14 Jul 2017 16:41:15 +0200 Subject: [PATCH] CONFIG: cpu/sys information in profiling now OFF by default (issue #526) - since the cpu/sys information is invariant, it doesn't make much sense to emit by default at every time-step. --- etc/controlDict | 4 ++-- src/OpenFOAM/db/Time/Time.C | 2 +- src/OpenFOAM/global/profiling/profiling.C | 18 +++++++++--------- src/OpenFOAM/global/profiling/profiling.H | 6 +++--- .../global/profiling/profilingInformation.C | 6 +----- .../global/profiling/profilingTrigger.C | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-) diff --git a/etc/controlDict b/etc/controlDict index a30f85c29f..4b53bf4c36 100644 --- a/etc/controlDict +++ b/etc/controlDict @@ -109,9 +109,9 @@ OptimisationSwitches profiling { active true; - cpuInfo true; + cpuInfo false; memInfo false; - sysInfo true; + sysInfo false; } */ diff --git a/src/OpenFOAM/db/Time/Time.C b/src/OpenFOAM/db/Time/Time.C index 0a7ae9f3df..93d58ca42c 100644 --- a/src/OpenFOAM/db/Time/Time.C +++ b/src/OpenFOAM/db/Time/Time.C @@ -357,7 +357,7 @@ void Foam::Time::setMonitoring(const bool forceProfiling) else if ( profilingDict - && profilingDict->lookupOrDefault("active", true) + && profilingDict->lookupOrDefault("active", true) ) { profiling::initialize diff --git a/src/OpenFOAM/global/profiling/profiling.C b/src/OpenFOAM/global/profiling/profiling.C index 62e331e166..7b6c7c441a 100644 --- a/src/OpenFOAM/global/profiling/profiling.C +++ b/src/OpenFOAM/global/profiling/profiling.C @@ -38,7 +38,7 @@ int Foam::profiling::allowed Foam::debug::infoSwitch("allowProfiling", 1) ); -Foam::profiling* Foam::profiling::pool_(0); +Foam::profiling* Foam::profiling::pool_(nullptr); // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // @@ -179,7 +179,7 @@ void Foam::profiling::stop(const Time& owner) if (pool_ && &owner == &(pool_->owner_)) { delete pool_; - pool_ = 0; + pool_ = nullptr; } } @@ -274,18 +274,18 @@ Foam::profiling::profiling timers_(), sysInfo_ ( - dict.lookupOrDefault("sysInfo", true) - ? new profilingSysInfo() : 0 + dict.lookupOrDefault("sysInfo", false) + ? new profilingSysInfo() : nullptr ), cpuInfo_ ( - dict.lookupOrDefault("cpuInfo", true) - ? new cpuInfo() : 0 + dict.lookupOrDefault("cpuInfo", false) + ? new cpuInfo() : nullptr ), memInfo_ ( - dict.lookupOrDefault("memInfo", false) - ? new memInfo() : 0 + dict.lookupOrDefault("memInfo", false) + ? new memInfo() : nullptr ) {} @@ -300,7 +300,7 @@ Foam::profiling::~profiling() if (pool_ == this) { - pool_ = 0; + pool_ = nullptr; profilingInformation::nextId_ = 0; } } diff --git a/src/OpenFOAM/global/profiling/profiling.H b/src/OpenFOAM/global/profiling/profiling.H index 26337bcc4e..90f47b173a 100644 --- a/src/OpenFOAM/global/profiling/profiling.H +++ b/src/OpenFOAM/global/profiling/profiling.H @@ -128,7 +128,7 @@ private: // Private Static Data Members //- Only one global pool object is possible - static profiling *pool_; + static profiling* pool_; // Private Data Members @@ -200,14 +200,14 @@ protected: profilingInformation* find(const string& descr, const label parentId); //- Add to hashed storage, - // returns pointer to newly stored element for chaining + // \return pointer to newly stored element for chaining profilingInformation* store(profilingInformation* info); //- Add to stack and set timer lookup (based on Id) void push(profilingInformation* info, clockTime& timer); //- Remove from stack and remove timer lookup (based on Id). - // Returns pointer to profiling information element + // \return pointer to profiling information element profilingInformation* pop(); diff --git a/src/OpenFOAM/global/profiling/profilingInformation.C b/src/OpenFOAM/global/profiling/profilingInformation.C index 937d5a01db..bc73478e51 100644 --- a/src/OpenFOAM/global/profiling/profilingInformation.C +++ b/src/OpenFOAM/global/profiling/profilingInformation.C @@ -150,11 +150,7 @@ Foam::Ostream& Foam::profilingInformation::write // * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * // -Foam::Ostream& Foam::operator<< -( - Ostream& os, - const profilingInformation& info -) +Foam::Ostream& Foam::operator<<(Ostream& os, const profilingInformation& info) { return info.write(os); } diff --git a/src/OpenFOAM/global/profiling/profilingTrigger.C b/src/OpenFOAM/global/profiling/profilingTrigger.C index 6eac94c05a..f02f4ee1ca 100644 --- a/src/OpenFOAM/global/profiling/profilingTrigger.C +++ b/src/OpenFOAM/global/profiling/profilingTrigger.C @@ -68,7 +68,7 @@ void Foam::profilingTrigger::stop() profiling::unstack(ptr_); // pointer is managed by pool storage -> thus no delete here } - ptr_ = 0; + ptr_ = nullptr; }