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>
@ -119,16 +121,22 @@ class eoTimerStat
void start( const std::string & key ) void start( const std::string & key )
{ {
_timers[ key ].restart(); if( eo::parallel.doMeasure() )
{
_timers[ key ].restart();
}
} }
void stop( const std::string& key ) void stop( const std::string& key )
{ {
Stat & s = _stats[ key ]; if( eo::parallel.doMeasure() )
eoTimer & t = _timers[ key ]; {
s.utime.push_back( t.usertime() ); Stat & s = _stats[ key ];
s.stime.push_back( t.systime() ); eoTimer & t = _timers[ key ];
s.wtime.push_back( t.wallclock() ); s.utime.push_back( t.usertime() );
s.stime.push_back( t.systime() );
s.wtime.push_back( t.wallclock() );
}
} }
std::map< std::string, Stat > stats() std::map< std::string, Stat > stats()