19#include <nvtx3/nvToolsExt.h>
39 long int timestampSeconds = timestampNanoseconds / 1000 / 1000 / 1000;
40 const int HourScaling = 60 * 60;
41 long int hours = timestampSeconds / HourScaling;
42 timestampSeconds = timestampSeconds - HourScaling * hours;
44 const int MinutesScaling = 60;
45 long int minutes = timestampSeconds / MinutesScaling;
46 timestampSeconds = timestampSeconds - MinutesScaling * minutes;
48 const int SecondsScaling = 1;
49 long int seconds = timestampSeconds / SecondsScaling;
51 std::stringstream result;
55 result << hours <<
":";
59 result << minutes <<
":";
68 [[maybe_unused]] std::string messageType,
69 [[maybe_unused]]
long int timestampNanoseconds,
70 [[maybe_unused]]
int rank,
71 [[maybe_unused]]
int threadId,
72 [[maybe_unused]]
const std::string& trace,
73 [[maybe_unused]]
const std::string& message
75 std::ostringstream result;
76 result << getTimeStampHumanReadable(timestampNanoseconds)
79 <<
"\t" << messageType
87 #if !defined(PeanoDebug) || PeanoDebug<1
91 std::string outputMessage = constructMessageString(
93 timestampNanoseconds, rank, threadId, trace, message
97 std::cout << outputMessage;
102 std::string outputMessage = constructMessageString(
104 timestampNanoseconds, rank, threadId, trace, message
108 std::cout << outputMessage;
113 std::string outputMessage = constructMessageString(
115 timestampNanoseconds, rank, threadId, trace, message
119 std::cerr << outputMessage;
125 std::string outputMessage = constructMessageString(
127 timestampNanoseconds, rank, threadId, trace, message
131 std::cerr << outputMessage;
139 [[maybe_unused]]
long int timestampNanoseconds,
140 [[maybe_unused]]
int rank,
141 [[maybe_unused]]
int threadId,
142 [[maybe_unused]]
const std::string& trace,
143 [[maybe_unused]]
const std::string& message
146 nvtxRangePush(trace.c_str());
152 [[maybe_unused]]
long int timestampNanoseconds,
153 [[maybe_unused]]
int rank,
154 [[maybe_unused]]
int threadId,
155 [[maybe_unused]]
const std::string& trace,
156 [[maybe_unused]]
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 NVTXLogger _singleton
void traceIn(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
void info(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
NVTXLogger()
It's a singleton.
static NVTXLogger & getInstance()
void warning(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
Write Warning.
void traceOut(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
std::string getTimeStampHumanReadable(long int timestampNanoseconds) const
void error(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
Write Error.
void debug(long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
std::string constructMessageString(std::string messageType, long int timestampNanoseconds, int rank, int threadId, const std::string &trace, const std::string &message)
Construct message string.
Create a lock around a boolean semaphore region.
static const std::string TargetDebug
static const std::string TargetInfo