VR-Forces Development_Version Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator 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 //remove the _WIN32 call once linux builds are working
20 #if defined(_WIN32)/* && !defined(_DEBUG)*/
21 #define DtVRF_PROFILE_RESTRICTED(name, target) makVrf::DtProfileTarget<target> _profileTarget##line(name);
22 #define DtVRF_PROFILE(name) DtVRF_PROFILE_X(name, __LINE__, makVrf::DtProfileNode::ENONE)
23 #define DtVRF_PROFILE_FILE(name) DtVRF_PROFILE_X(name, __LINE__, makVrf::DtProfileNode::EVIRTUAL)
24 #define DtVRF_PROFILE_X(name, line, attr) DtVRF_PROFILE_ACTUAL(name, line, attr)
25 #define DtVRF_PROFILE_ACTUAL(name, line, attr) makVrf::DtProfileSample _profileSample##line(name, attr);
26 #else
27 #define DtVRF_PROFILE(name)
28 #define DtVRF_PROFILE_FILE(name)
29 #define DtVRF_PROFILE_RESTRICTED(name, target)
30 #endif
31 
32 namespace makVrf
33 {
39  {
40  public:
42  explicit DtProfileSample(
43  const char* name = 0, DtProfileNode::Attributes = DtProfileNode::ENONE);
44  explicit DtProfileSample(
45  const std::string& n, DtProfileNode::Attributes = DtProfileNode::ENONE);
46 
48  ~DtProfileSample();
49 
50  private:
51  bool enabled;
52  const char* name;
55  };
56 
61  template <bool Enabled>
63  {
64  public:
65  explicit DtProfileTarget(
66  const char* name = 0,
68 
69  void reset(const char* = 0) {}
70  };
71 
72  template <>
73  class DtProfileTarget<true> : public DtProfileSample
74  {
75  public:
77  explicit DtProfileTarget(
78  const char* name = 0,
80  : DtProfileSample(name, attr) { }
81  };
82 }
83 

Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (www.mak.com)