From ea58a523da3d0be25df2b900939ecee6a97cce2c Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 23 Jun 2016 14:34:45 +0200 Subject: [PATCH] ENH: use long for number of calls in profiling (issue #157) - provide a static profiling::print(Ostream&) method to output values to a log file. --- src/OpenFOAM/global/profiling/profiling.C | 13 +++++++++++++ src/OpenFOAM/global/profiling/profiling.H | 11 +++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/OpenFOAM/global/profiling/profiling.C b/src/OpenFOAM/global/profiling/profiling.C index ee63a82efe..a292172c21 100644 --- a/src/OpenFOAM/global/profiling/profiling.C +++ b/src/OpenFOAM/global/profiling/profiling.C @@ -73,6 +73,19 @@ bool Foam::profiling::active() } +bool Foam::profiling::print(Ostream& os) +{ + if (pool_) + { + return pool_->writeData(os); + } + else + { + return false; + } +} + + bool Foam::profiling::writeNow() { if (pool_) diff --git a/src/OpenFOAM/global/profiling/profiling.H b/src/OpenFOAM/global/profiling/profiling.H index 4986a92168..c6872f8e2b 100644 --- a/src/OpenFOAM/global/profiling/profiling.H +++ b/src/OpenFOAM/global/profiling/profiling.H @@ -190,14 +190,21 @@ protected: public: - // Member Functions + // Static Member Functions //- True if profiling is active static bool active(); + //- Print profiling information to specified output + // Forwards to writeData member of top-level object + static bool print(Ostream&); + //- Write profiling information now static bool writeNow(); + + // Member Functions + //- The owner of the profiling const Time& owner() const; @@ -248,7 +255,7 @@ class profiling::Information Information* parent_; //- Nr of times this was called - label calls_; + long calls_; //- Total time spent scalar totalTime_;