VR-Vantage 2.5 API 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) 2019 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
19 // should pass a "const char*" as name because the pointer is getting
20 // used to do the string compare (to be fast)
21 // if a std::string is passed instead it will cause a crashed when
22 // loading/unloading terrain with the performance/stats displayed
23 #define DtPROFILE_RESTRICTED(name, target) makVrv::DtProfileTarget<target> _profileTarget##line(name);
24 #define DtPROFILE(name) DtPROFILE_X(name, __LINE__)
25 #define DtPROFILE_X(name, line) DtPROFILE_ACTUAL(name, line)
26 #define DtPROFILE_ACTUAL(name, line) makVrv::DtProfileSample _profileSample##line(name);
27 #define DtPROFILE_FUNCTION(name, func) {makVrv::DtProfileSample _profileSample(name); (func);}
28 #define DtPROFILE_SECTION(name) { makVrv::DtProfileSample _profileSample(name);
29 #define DtPROFILE_SECTION_END }
30 
31 #define DtPERFORMANCE_STAT(name) DtPERFORMANCE_STAT_X(name, __LINE__)
32 #define DtPERFORMANCE_STAT_X(name, line) DtPERFORMANCE_STAT_ACTUAL(name, line)
33 #define DtPERFORMANCE_STAT_ACTUAL(name, line) makVrv::DtPerfomanceStatSample _performanceStatSample##line(name);
34 
35 
36 // These constants configure DtPROFILE_RESTRICTED
37 //
38 // Define them to boost::true_type to enable profiling of those sections
39 const bool Profile_DtSceneObjectUpdater = false;
41 const bool Profile_DtOsgCullVisitor = false;
42 
43 namespace makVrv
44 {
50  {
51  public:
53  DtProfileSample(const char* name )
54  {
56  }
57 
60  {
62  }
63  };
64 
69  template <bool Enabled>
71  {
72  DtProfileTarget(const char* name) {}
73  };
74 
75  template <>
76  struct DtProfileTarget<true>
77  {
79  DtProfileTarget(const char* name )
80  {
82  }
83 
86  {
88  }
89  };
90 
96  {
97  public:
100  {
102  }
103 
106  {
108  }
109  };
110 }
111 


Copyright © 2005-2019 VT MAK. All Rights Reserved (www.mak.com)