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 #if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
37 #include <CoreServices/CoreServices.h>
38 #include <mach/mach.h>
39 #include <mach/mach_time.h>
40 #undef check
41 #endif
42 
43 #if !defined(Q_OS_WIN) && !defined(Q_OS_ANDROID)
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 timeStamp();
97 
98  static void hexDump(const QString& str);
99 
100 private:
101 #if defined(Q_OS_MAC) && !defined(Q_OS_IOS)
102  static QMap<int, uint64_t> timerMac;
103 #else
104  static QMap<int, QTime> timer;
105 #endif
106 };
107 
109 
110 #endif