9 #define PP_CAT(a, b) PP_CAT_I(a, b) 10 #define PP_CAT_I(a, b) PP_CAT_II(~, a##b) 11 #define PP_CAT_II(p, res) res 13 #define PP_UNIQUE_NAME(base) PP_CAT(base, __COUNTER__) 15 #define PROFILECLEAR \ 17 Base::Timer::clearAll(); \ 19 #define PROFILEENABLE(a) \ 21 Base::Timer::enable(a); \ 23 #define PROFILESTART(a) \ 25 Base::Timer::profileStart(a); \ 27 #define PROFILESTOP(a) \ 29 Base::Timer::profileStop(a); \ 31 #define PROFILESCOPED(a) Base::scopedProfile PP_UNIQUE_NAME(scopedProfile__)(a); 36 #if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) 38 class LX_BASE_EXPORT timerIFace
41 virtual void resetTotal() = 0;
42 virtual void reset() = 0;
43 virtual double elapsedMS() = 0;
44 virtual double elapsed()
const = 0;
45 virtual double start() = 0;
46 virtual void restart() = 0;
47 virtual double stop() = 0;
48 virtual double totalSeconds() = 0;
49 virtual double totalMS() = 0;
50 virtual long count() = 0;
51 virtual std::string getName() = 0;
52 virtual timerIFace* getParent() = 0;
53 virtual void setParent(timerIFace*) = 0;
54 virtual void addChild(timerIFace*) = 0;
55 virtual std::set<timerIFace*> getChildren() = 0;
58 class LX_BASE_EXPORT timer_dummy :
public timerIFace
64 double elapsedMS() {
return 0.0; };
65 double elapsed()
const {
return 0.0; };
66 double start() {
return 0.0; };
68 double stop() {
return 0.0; };
69 double totalSeconds() {
return 0.0; };
70 double totalMS() {
return 0.0; };
71 long count() {
return 0; };
72 std::string getName() {
return std::string(); };
73 timerIFace* getParent() {
return 0; };
74 void setParent(timerIFace*){};
75 void addChild(timerIFace*){};
76 std::set<timerIFace*> getChildren() {
return std::set<timerIFace*>(); };
81 class LX_BASE_EXPORT Timer :
public timerIFace
90 double elapsed()
const;
94 double totalSeconds();
98 std::string getName() {
return _name; };
99 void setParent(timerIFace*);
100 timerIFace* getParent();
103 void addChild(timerIFace* c) { _children.insert(c); };
104 std::set<timerIFace*> getChildren() {
return _children; };
106 static timerIFace* getTimer(std::string
name);
107 static void stopTimer(std::string
name);
108 static std::map<std::string, timerIFace*> getTimerMap();
109 static void setCurrent(timerIFace* p);
110 static timerIFace* getCurrent();
112 static void clearAll();
113 double startTiming();
114 static std::map<void*, double> TimeStorage;
116 static void enable(
bool v);
117 static bool isEnabled();
120 static void profileStart(
const char* a);
121 static void profileStop(
const char* a);
123 static void printTimer(
char* header);
129 double _totalseconds;
132 timerIFace* _parentTimer = 0;
133 std::set<timerIFace*> _children;
134 static timerIFace* _currentTimer;
135 static bool _enabled;
136 static std::map<std::string, timerIFace*> _timerMap;
139 static Base::timer_dummy my_timer_dummy;
140 static Base::timer_dummy* my_timer_dummy_ptr = &my_timer_dummy;
151 double elapsed()
const {
return double(clock() - _start_time) / CLOCKS_PER_SEC; }
#define PROFILESTOP(a)
Definition: Timer.h:27
void restart()
Definition: Timer.h:150
Core::PropertyText name
Definition: CoreDocument.h:167
timer()
Definition: Timer.h:149
double elapsed() const
Definition: Timer.h:151
#define PROFILESTART(a)
Definition: Timer.h:23
~scopedProfile()
Definition: Timer.h:161
Definition: AbstractXMLReader.h:5
std::string m_name
Definition: Timer.h:163
scopedProfile(const char *a)
Definition: Timer.h:160