VR-Forces 4.6.1 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
profiler.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 "vrfutil/vrfutilDefines.h"
14 #include "vrfutil/profileManager.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 #define DtVRF_PROFILE_RESTRICTED(name, target) makVrf::DtProfileTarget<target> _profileTarget##line(name);
20 #define DtVRF_PROFILE(name) DtVRF_PROFILE_X(name, __LINE__, makVrf::DtProfileNode::ENONE)
21 #define DtVRF_PROFILE_FILE(name) DtVRF_PROFILE_X(name, __LINE__, makVrf::DtProfileNode::EVIRTUAL)
22 #define DtVRF_PROFILE_X(name, line, attr) DtVRF_PROFILE_ACTUAL(name, line, attr)
23 #define DtVRF_PROFILE_ACTUAL(name, line, attr) makVrf::DtProfileSample _profileSample##line(name, attr);
24 
25 namespace makVrf
26 {
32  {
33  public:
35  explicit DtProfileSample(
36  const char* name = 0, DtProfileNode::Attributes = DtProfileNode::ENONE);
37  explicit DtProfileSample(
38  const std::string& n, DtProfileNode::Attributes = DtProfileNode::ENONE);
39 
41  ~DtProfileSample();
42 
43  private:
44  bool enabled;
45  const char* name;
48  };
49 
54  template <bool Enabled>
56  {
57  public:
58  explicit DtProfileTarget(
59  const char* name = 0,
61 
62  void reset(const char* = 0) {}
63  };
64 
65  template <>
66  class DtProfileTarget<true> : public DtProfileSample
67  {
68  public:
70  explicit DtProfileTarget(
71  const char* name = 0,
73  : DtProfileSample(name, attr) { }
74  };
75 }
76 

Document ID: Generated on Wed Jul 25 16:57:45 EDT 2018 from SVN revision 190790
Copyright © 2005-2018 VT MÄK. All Rights Reserved (www.mak.com)