2015-07-23 17:31:13 +01:00
|
|
|
#include <Grid.h>
|
|
|
|
|
|
|
|
namespace Grid {
|
|
|
|
|
|
|
|
GridStopWatch GridLogger::StopWatch;
|
|
|
|
std::ostream GridLogger::devnull(0);
|
|
|
|
|
|
|
|
GridLogger GridLogError (1,"Error");
|
|
|
|
GridLogger GridLogWarning (1,"Warning");
|
|
|
|
GridLogger GridLogMessage (1,"Message");
|
|
|
|
GridLogger GridLogDebug (1,"Debug");
|
|
|
|
GridLogger GridLogPerformance(1,"Performance");
|
|
|
|
GridLogger GridLogIterative (1,"Iterative");
|
|
|
|
|
|
|
|
void GridLogConfigure(std::vector<std::string> &logstreams)
|
|
|
|
{
|
|
|
|
GridLogError.Active(0);
|
|
|
|
GridLogWarning.Active(0);
|
|
|
|
GridLogMessage.Active(0);
|
|
|
|
GridLogIterative.Active(0);
|
|
|
|
GridLogDebug.Active(0);
|
|
|
|
GridLogPerformance.Active(0);
|
|
|
|
|
|
|
|
for(int i=0;i<logstreams.size();i++){
|
|
|
|
if ( logstreams[i]== std::string("Error") ) GridLogError.Active(1);
|
|
|
|
if ( logstreams[i]== std::string("Warning") ) GridLogWarning.Active(1);
|
|
|
|
if ( logstreams[i]== std::string("Message") ) GridLogMessage.Active(1);
|
|
|
|
if ( logstreams[i]== std::string("Iterative") ) GridLogIterative.Active(1);
|
|
|
|
if ( logstreams[i]== std::string("Debug") ) GridLogDebug.Active(1);
|
|
|
|
if ( logstreams[i]== std::string("Performance") ) GridLogPerformance.Active(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
// Verbose limiter on MPI tasks
|
|
|
|
////////////////////////////////////////////////////////////
|
|
|
|
void Grid_quiesce_nodes(void)
|
|
|
|
{
|
|
|
|
#ifdef GRID_COMMS_MPI
|
|
|
|
int me;
|
|
|
|
MPI_Comm_rank(MPI_COMM_WORLD,&me);
|
|
|
|
if ( me ) {
|
2015-07-27 10:32:28 +01:00
|
|
|
std::cout.setstate(std::ios::badbit);
|
2015-07-23 17:31:13 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
void Grid_unquiesce_nodes(void)
|
|
|
|
{
|
|
|
|
#ifdef GRID_COMMS_MPI
|
2015-07-27 10:32:28 +01:00
|
|
|
std::cout.clear();
|
2015-07-23 17:31:13 +01:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
std::ostream& operator<< (std::ostream& stream, const GridTime& time)
|
|
|
|
{
|
|
|
|
stream << time.count()<<" ms";
|
|
|
|
return stream;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|