QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RDebug.h
Go to the documentation of this file.
1 
20 #ifndef RDEBUG_H
21 #define RDEBUG_H
22 
23 #include "core_global.h"
24 
25 #include <fstream>
26 #include <ostream>
27 #include <stdarg.h>
28 #include <stdio.h>
29 
30 #include <QString>
31 #include <QTime>
32 #include <QMap>
33 #include <QFile>
34 #include <QMetaType>
35 
36 #ifdef Q_OS_MAC
37 #include <CoreServices/CoreServices.h>
38 #include <mach/mach.h>
39 #include <mach/mach_time.h>
40 #undef check
41 #endif
42 
43 #ifndef Q_OS_WIN32
44 #include <execinfo.h>
45 #endif
46 
47 #ifndef RDEFAULT_QSTRING
48 #define RDEFAULT_QSTRING QString()
49 #endif
50 
74 public:
75  static void printBacktrace(const QString& prefix = RDEFAULT_QSTRING);
76 
80  static void startTimer(int id=0);
81 
86  static int stopTimer(int id, const QString& msg);
87 
92  static int stopTimer(const QString& msg) {
93  return stopTimer(0, msg);
94  }
95 
96  static void hexDump(const QString& str);
97 
98 private:
99 #ifdef Q_OS_MAC
100  static QMap<int, uint64_t> timerMac;
101 #else
102  static QMap<int, QTime> timer;
103 #endif
104 };
105 
107 
108 #endif