From 4ab5b2fd8983eb24be122ac009e46bc9a6876cf7 Mon Sep 17 00:00:00 2001 From: Benjamin Bouvier Date: Wed, 11 Jul 2012 11:41:10 +0200 Subject: [PATCH] Taking time measures only if parallel.doMeasure() is true. --- eo/src/utils/eoTimer.h | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/eo/src/utils/eoTimer.h b/eo/src/utils/eoTimer.h index c97ab5d3..8aa09c51 100644 --- a/eo/src/utils/eoTimer.h +++ b/eo/src/utils/eoTimer.h @@ -7,6 +7,8 @@ # include # include +# include "utils/eoParallel.h" + # ifdef WITH_MPI # include # include @@ -119,16 +121,22 @@ class eoTimerStat void start( const std::string & key ) { - _timers[ key ].restart(); + if( eo::parallel.doMeasure() ) + { + _timers[ key ].restart(); + } } void stop( const std::string& key ) { - Stat & s = _stats[ key ]; - eoTimer & t = _timers[ key ]; - s.utime.push_back( t.usertime() ); - s.stime.push_back( t.systime() ); - s.wtime.push_back( t.wallclock() ); + if( eo::parallel.doMeasure() ) + { + Stat & s = _stats[ key ]; + eoTimer & t = _timers[ key ]; + s.utime.push_back( t.usertime() ); + s.stime.push_back( t.systime() ); + s.wtime.push_back( t.wallclock() ); + } } std::map< std::string, Stat > stats()