VR-Forces 4.3 Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vrvUtil
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
>
14
#include <
vrvUtil/DtProfileManager.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
;
46
const
bool
Profile_DtSurfaceClampingUpdater
=
false
;
47
const
bool
Profile_DtOsgCullVisitor
=
false
;
48
49
namespace
makVrv
50
{
55
class
DT_DLL_VRVUTIL
DtProfileSample
56
{
57
public
:
59
DtProfileSample
(
const
char
* name )
60
{
61
DtProfileManager::startProfile
( name );
62
}
63
65
~
DtProfileSample
( )
66
{
67
DtProfileManager::stopProfile
();
68
}
69
};
70
75
template
<
bool
Enabled>
76
struct
DtProfileTarget
77
{
78
DtProfileTarget
(
const
char
* name) {}
79
};
80
81
template
<>
82
struct
DtProfileTarget
<true>
83
{
85
DtProfileTarget
(
const
char
* name )
86
{
87
DtProfileManager::startProfile
( name );
88
}
89
91
~
DtProfileTarget
( )
92
{
93
DtProfileManager::stopProfile
();
94
}
95
};
96
101
class
DT_DLL_VRVUTIL
DtPerfomanceStatSample
102
{
103
public
:
105
DtPerfomanceStatSample
(
const
char
* name )
106
{
107
DtProfileManager::startPerformanceStat
( name );
108
}
109
111
~
DtPerfomanceStatSample
( )
112
{
113
DtProfileManager::stopPerformanceStat
();
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
)