VR-Forces 4.3 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
DtProfiler.h
Go to the documentation of this file.
1 /*********************************************************************************
2 ** Copyright (c) 2014 MAK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************************/
5 
10 
11 #pragma once
12 
13 #include <vrvUtil/vrvUtil.h>
15 
16 #include <boost/type_traits/integral_constant.hpp>
17 
18 //easy to use macro to profile a section, only active in profile or debug builds
19 //remove the _WIN32 call once linux builds are working
20 #if defined(_WIN32)/* && !defined(_DEBUG)*/
21 #define DtPROFILE_RESTRICTED(name, target) makVrv::DtProfileTarget<target> _profileTarget##line(name);
22 #define DtPROFILE(name) DtPROFILE_X(name, __LINE__)
23 #define DtPROFILE_X(name, line) DtPROFILE_ACTUAL(name, line)
24 #define DtPROFILE_ACTUAL(name, line) makVrv::DtProfileSample _profileSample##line(name);
25 #define DtPROFILE_FUNCTION(name, func) {makVrv::DtProfileSample _profileSample(name); (func);}
26 #define DtPROFILE_SECTION(name) { makVrv::DtProfileSample _profileSample(name);
27 #define DtPROFILE_SECTION_END }
28 
29 #define DtPERFORMANCE_STAT(name) DtPERFORMANCE_STAT_X(name, __LINE__)
30 #define DtPERFORMANCE_STAT_X(name, line) DtPERFORMANCE_STAT_ACTUAL(name, line)
31 #define DtPERFORMANCE_STAT_ACTUAL(name, line) makVrv::DtPerfomanceStatSample _performanceStatSample##line(name);
32 #else
33 #define DtPROFILE(name)
34 #define DtPROFILE_RESTRICTED(name, target)
35 #define DtPROFILE_FUNCTION(name, func) (func);
36 #define DtPROFILE_SECTION(name)
37 #define DtPROFILE_SECTION_END
38 #define DtPERFORMANCE_STAT(name)
39 #endif
40 
41 
42 // These constants configure DtPROFILE_RESTRICTED
43 //
44 // Define them to boost::true_type to enable profiling of those sections
45 const bool Profile_DtSceneObjectUpdater = false;
47 const bool Profile_DtOsgCullVisitor = false;
48 
49 namespace makVrv
50 {
56  {
57  public:
59  DtProfileSample(const char* name )
60  {
62  }
63 
66  {
68  }
69  };
70 
75  template <bool Enabled>
77  {
78  DtProfileTarget(const char* name) {}
79  };
80 
81  template <>
82  struct DtProfileTarget<true>
83  {
85  DtProfileTarget(const char* name )
86  {
88  }
89 
92  {
94  }
95  };
96 
102  {
103  public:
105  DtPerfomanceStatSample(const char* name )
106  {
108  }
109 
112  {
114  }
115  };
116 }
117 

Document ID: Generated on Wed Mar 11 21:20:57 EDT 2015 from SVN revision 150940
Copyright © 2005-2014 VT MÄK. All Rights Reserved (www.mak.com)