QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RDebug.h
Go to the documentation of this file.
1 #ifndef RDEBUG_H
2 #define RDEBUG_H
3 
4 #include <fstream>
5 #include <ostream>
6 #include <stdarg.h>
7 #include <stdio.h>
8 
9 #include <QString>
10 #include <QTime>
11 #include <QMap>
12 #include <QFile>
13 #include <QMetaType>
14 
15 #ifdef Q_OS_MAC
16 #include <CoreServices/CoreServices.h>
17 #include <mach/mach.h>
18 #include <mach/mach_time.h>
19 #undef check
20 #endif
21 
22 #ifndef Q_OS_WIN32
23 #include <execinfo.h>
24 #endif
25 
26 #ifndef RDEFAULT_QString
27 #define RDEFAULT_QString QString()
28 #endif
29 
52 class RDebug {
53 public:
54  static void printBacktrace(const QString& prefix = RDEFAULT_QString);
55 
59  static void startTimer(int id=0);
60 
65  static int stopTimer(int id, const QString& msg);
66 
71  static int stopTimer(const QString& msg) {
72  return stopTimer(0, msg);
73  }
74 
75 private:
76 #ifdef Q_OS_MAC
77  static QMap<int, uint64_t> timerMac;
78 #else
79  static QMap<int, QTime> timer;
80 #endif
81 };
82 
84 
85 #endif