Taking time measures only if parallel.doMeasure() is true.

This commit is contained in:
Benjamin Bouvier 2012-07-11 11:41:10 +02:00
commit 4ab5b2fd89

View file

@ -7,6 +7,8 @@
# include <vector> # include <vector>
# include <map> # include <map>
# include "utils/eoParallel.h"
# ifdef WITH_MPI # ifdef WITH_MPI
# include <boost/serialization/access.hpp> # include <boost/serialization/access.hpp>
# include <boost/serialization/vector.hpp> # include <boost/serialization/vector.hpp>
@ -118,11 +120,16 @@ class eoTimerStat
# endif # endif
void start( const std::string & key ) void start( const std::string & key )
{
if( eo::parallel.doMeasure() )
{ {
_timers[ key ].restart(); _timers[ key ].restart();
} }
}
void stop( const std::string& key ) void stop( const std::string& key )
{
if( eo::parallel.doMeasure() )
{ {
Stat & s = _stats[ key ]; Stat & s = _stats[ key ];
eoTimer & t = _timers[ key ]; eoTimer & t = _timers[ key ];
@ -130,6 +137,7 @@ class eoTimerStat
s.stime.push_back( t.systime() ); s.stime.push_back( t.systime() );
s.wtime.push_back( t.wallclock() ); s.wtime.push_back( t.wallclock() );
} }
}
std::map< std::string, Stat > stats() std::map< std::string, Stat > stats()
{ {