Code::Blocks  SVN r11506
profiletimer.h
Go to the documentation of this file.
1 /*
2  * This file is part of the Code::Blocks IDE and licensed under the GNU General Public License, version 3
3  * http://www.gnu.org/licenses/gpl-3.0.html
4  */
5 
6 #ifndef PROFILETIMER_H
7 #define PROFILETIMER_H
8 
9 #include <wx/stopwatch.h>
10 #include <wx/string.h>
11 
12 #include <map>
13 
14 //#define CC_PARSER_PROFILE_TEST 1
15 
16 #if defined(CC_PARSER_PROFILE_TEST)
17  #if CC_PARSER_PROFILE_TEST
18  #define CC_PROFILE_TIMER() \
19  static ProfileTimerData __ptd; \
20  static size_t __i = ProfileTimer::Registry(&__ptd, wxString(__PRETTY_FUNCTION__, wxConvUTF8)); \
21  __ptd.m_CallTimes += __i; \
22  ProfileTimerHelper __profileTimerHelper(__ptd)
23  #define CC_PROFILE_TIMER_LOG() ProfileTimer::Log()
24  #else
25  #define CC_PROFILE_TIMER()
26  #define CC_PROFILE_TIMER_LOG()
27  #endif
28 #endif
29 
31 {
32 public:
34  void Zero();
35 
37  size_t m_CallTimes;
38  size_t m_Count;
39 };
40 
42 {
43 public:
44  ProfileTimerHelper(ProfileTimerData& profileTimerData);
46 private:
48 };
49 
51 {
52 public:
53  static size_t Registry(ProfileTimerData* ptd, const wxString& funcName);
54  static void Log();
55 
56 private:
57  typedef std::map<ProfileTimerData*, wxString> ProfileMap;
58  static ProfileMap m_ProfileMap;
59 };
60 
61 #endif // PROFILETIMER_H
ProfileTimerData & m_ProfileTimerData
Definition: profiletimer.h:47
std::map< ProfileTimerData *, wxString > ProfileMap
Definition: profiletimer.h:57
wxStopWatch m_StopWatch
Definition: profiletimer.h:36
static ProfileMap m_ProfileMap
Definition: profiletimer.h:58