43#define MNE_TRACE() UTILSLIB::MNETracer _mneTracer__LINE__(__FILE__,__func__,__LINE__);
44#define MNE_TRACER_ENABLE(FILENAME) UTILSLIB::MNETracer::enable(#FILENAME);
45#define MNE_TRACER_DISABLE UTILSLIB::MNETracer::disable();
46#define MNE_TRACE_VALUE(NAME, VALUE) UTILSLIB::MNETracer::traceQuantity(NAME, VALUE);
49#define MNE_TRACER_ENABLE(FILENAME)
50#define MNE_TRACER_DISABLE
51#define MNE_TRACE_VALUE()
54#ifdef MNE_TRACE_MEMORY
55#define MNE_TRACE_MEMORY_REPORT \
56std::cout << "Total Memory Allocated : " << 0.000001 * __totalMemAllocated << " MB\n";\
57std::cout << "Total Memory Deleted : " << 0.000001 * __totalMemDeleted << " MB\n";\
58std::cout << "Total Memory Diff : " << 0.000001 * (__totalMemAllocated - __totalMemDeleted) << " MB\n";\
60size_t __totalMemAllocated(0);
61size_t __totalMemDeleted(0);
62void *
operator new(
size_t size)
65 __totalMemAllocated += size;
69void operator delete(
void *memory,
size_t size)
72 __totalMemDeleted += size;
76#define MNE_TRACE_MEMORY_REPORT
133 MNETracer(
const std::string& file,
const std::string& function,
int lineNumber);
146 static void enable(
const std::string& jsonFileName);
163 static void start(
const std::string& jsonFileName);
180 static void traceQuantity(
const std::string& name,
long val);
199 static void writeHeader();
205 static void writeFooter();
211 static void writeToFile(
const std::string& str);
217 static void setZeroTime();
223 static long long getTimeNow();
234 void formatFileName();
239 void formatFunctionName();
244 void registerConstructionTime();
249 void registerFinalTime();
254 void registerThreadId();
259 void calculateDuration();
264 void printDurationMiliSec();
269 void writeBeginEvent();
274 void writeEndEvent();
276 static bool ms_bIsEnabled;
277 static std::ofstream ms_OutputFileStream;
278 static bool ms_bIsFirstEvent;
279 static std::mutex ms_outFileMutex;
280 static long long ms_iZeroTime;
282 bool m_bIsInitialized;
283 bool m_bPrintToTerminal;
284 std::string m_sFileName;
285 std::string m_sFunctionName;
287 std::string m_iThreadId;
288 long long m_iBeginTime;
289 long long m_iEndTime;
290 double m_dDurationMilis;
utils library export/import macros.
#define UTILSSHARED_EXPORT
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
bool printToTerminalIsSet()
static void stop()
Convenience overload of the method disable.
static void disable()
disable If the class "is enabled" (it's static variabable ms_bIsEnabled is true), the output file has...
MNETracer(const std::string &file, const std::string &function, int lineNumber)
MNETracer constructor will check if the class "is enabled". If it is, it will record the creation tim...
static void traceQuantity(const std::string &name, long val)
traceQuantity Allows to keep track of a specific variable in the output tracing file.
static void start(const std::string &jsonFileName)
Convenience overload of the method enable.
static void enable(const std::string &jsonFileName)
void setPrintToTerminal(bool s)