34 #ifndef LIFECHRONOMANAGER_HPP 35 #define LIFECHRONOMANAGER_HPP 37 #include <Epetra_ConfigDefs.h> 40 #include <Epetra_MpiComm.h> 42 #include <Epetra_SerialComm.h> 45 #include <lifev/core/LifeV.hpp> 46 #include <lifev/core/util/LifeChrono.hpp> 83 void print ( std::ostream& out = std::cout );
94 template <
typename TimerType>
97 UInt const nameSize = name.size();
102 M_timerList.insert ( std::make_pair ( name, timer) );
105 template <
typename TimerType>
108 bool isLeader = M_comm->MyPID() == 0;
110 std::vector<Real> times ( M_timerList.size() );
113 for (
typename timerList_Type::const_iterator it = M_timerList.begin();
114 it != M_timerList.end(); ++it, count++ )
116 times[ count ] = it->second->globalDiff ( *M_comm );
117 globalTime += times[ count ];
122 out << std::string (S_printSize,
'=') << std::endl;
124 out << std::setw ( S_columnSize ) <<
"Time (s)";
125 out << std::setw ( S_columnSize ) <<
"Perc (%)" << std::endl;
126 out << std::string (S_printSize,
'=') << std::endl;
129 for (
typename timerList_Type::const_iterator it = M_timerList.begin();
130 it != M_timerList.end(); ++it, count++ )
132 out << std::setw ( M_stringMaxSize ) << it->first;
133 out << std::setw ( S_columnSize ) << std::fixed << std::setprecision (2) << times[ count ];
134 out << std::setw ( S_columnSize ) << std::fixed << std::setprecision (2) << 100.* times[ count ] / globalTime << std::endl;
136 out << std::string (S_printSize,
'=') << std::endl;
138 out << std::setw ( S_columnSize ) << std::fixed << std::setprecision (2) << globalTime;
139 out << std::setw ( S_columnSize ) << std::fixed << std::setprecision (2) << 100. << std::endl;
140 out << std::string (S_printSize,
'=') << std::endl;
static UInt const S_columnSize
LifeChronoManager(commPtr_Type comm)
Constructor.
void updateInverseJacobian(const UInt &iQuadPt)
void print(std::ostream &out=std::cout)
Print out strings and time diffs for the registered timers.
double Real
Generic real data.
void add(std::string const &name, timer_Type *timer)
Register a timer.
static UInt const S_printSize
std::map< std::string const, timer_Type * > timerList_Type
uint32_type UInt
generic unsigned integer (used mainly for addressing)
timerList_Type M_timerList
std::shared_ptr< Epetra_Comm const > commPtr_Type