30 _firstTraceWritten(false) {
32 #if !defined(Parallel)
47 #if !defined(Parallel)
72 long int timestampSeconds = timestampNanoseconds / 1000 / 1000 / 1000;
73 const int HourScaling = 60 * 60;
74 long int hours = timestampSeconds / HourScaling;
75 timestampSeconds = timestampSeconds - HourScaling * hours;
77 const int MinutesScaling = 60;
78 long int minutes = timestampSeconds / MinutesScaling;
79 timestampSeconds = timestampSeconds - MinutesScaling * minutes;
81 const int SecondsScaling = 1;
82 long int seconds = timestampSeconds / SecondsScaling;
84 std::stringstream result;
88 result << hours <<
":";
92 result << minutes <<
":";
102 [[maybe_unused]] std::string messageType,
103 [[maybe_unused]]
long int timestampNanoseconds,
104 [[maybe_unused]]
int rank,
105 [[maybe_unused]]
int threadId,
106 [[maybe_unused]]
const std::string& trace,
107 [[maybe_unused]]
const std::string& message
109 std::ostringstream result;
110 result << getTimeStampHumanReadable(timestampNanoseconds)
113 <<
"\t" << messageType
121 #if !defined(PeanoDebug) || PeanoDebug<1
125 std::string outputMessage = constructMessageString(
127 timestampNanoseconds, rank, threadId, trace, message
131 std::cout << outputMessage;
136 std::string outputMessage = constructMessageString(
138 timestampNanoseconds, rank, threadId, trace, message
142 std::cout << outputMessage;
147 std::string outputMessage = constructMessageString(
149 timestampNanoseconds, rank, threadId, trace, message
153 std::cerr << outputMessage;
159 std::string outputMessage = constructMessageString(
161 timestampNanoseconds, rank, threadId, trace, message
165 std::cerr << outputMessage;
174 [[maybe_unused]]
long int timestampNanoseconds,
175 [[maybe_unused]]
int rank,
176 [[maybe_unused]]
int threadId,
177 [[maybe_unused]]
const std::string& trace,
178 [[maybe_unused]]
const std::string& message
181 if (not _firstTraceWritten) {
182 _firstTraceWritten =
true;
188 if (_itacHandles.count(trace)==0) {
190 VT_funcdef( trace.c_str() , VT_NOCLASS, &newHandle );
191 _itacHandles.insert( std::pair<std::string, int>(trace,newHandle) );
194 VT_begin(_itacHandles[trace.c_str()]);
200 [[maybe_unused]]
long int timestampNanoseconds,
201 [[maybe_unused]]
int rank,
202 [[maybe_unused]]
int threadId,
203 [[maybe_unused]]
const std::string& trace,
204 [[maybe_unused]]
const std::string& message
207 VT_end(_itacHandles[trace.c_str()]);
void info(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
void traceIn(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
void indent(bool indent, const std::string &trace, const std::string &message)
Tells the logger to increment/decrement the indent.
static ITACLogger _singleton
std::string getTimeStampHumanReadable(long int timestampNanoseconds) const
void traceOut(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
void error(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
Write Error.
void warning(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
Write Warning.
std::string constructMessageString(std::string messageType, long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
Construct message string.
void debug(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
ITACLogger()
It's a singleton.
static ITACLogger & getInstance()
static void abort(int errorCode)
A proper abort in an MPI context has to use MPI_Abort.
Create a lock around a boolean semaphore region.
static const std::string TargetDebug
static const std::string TargetInfo