VR-Vantage API Documentation
Home
Modules
Namespaces
Classes
Files
Libraries
Examples
Tutorials
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) 2015 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
19
#define DtPROFILE_RESTRICTED(name, target) makVrv::DtProfileTarget<target> _profileTarget##line(name);
20
#define DtPROFILE(name) DtPROFILE_X(name, __LINE__)
21
#define DtPROFILE_X(name, line) DtPROFILE_ACTUAL(name, line)
22
#define DtPROFILE_ACTUAL(name, line) makVrv::DtProfileSample _profileSample##line(name);
23
#define DtPROFILE_FUNCTION(name, func) {makVrv::DtProfileSample _profileSample(name); (func);}
24
#define DtPROFILE_SECTION(name) { makVrv::DtProfileSample _profileSample(name);
25
#define DtPROFILE_SECTION_END }
26
27
#define DtPERFORMANCE_STAT(name) DtPERFORMANCE_STAT_X(name, __LINE__)
28
#define DtPERFORMANCE_STAT_X(name, line) DtPERFORMANCE_STAT_ACTUAL(name, line)
29
#define DtPERFORMANCE_STAT_ACTUAL(name, line) makVrv::DtPerfomanceStatSample _performanceStatSample##line(name);
30
31
32
// These constants configure DtPROFILE_RESTRICTED
33
//
34
// Define them to boost::true_type to enable profiling of those sections
35
const
bool
Profile_DtSceneObjectUpdater
=
false
;
36
const
bool
Profile_DtSurfaceClampingUpdater
=
false
;
37
const
bool
Profile_DtOsgCullVisitor
=
false
;
38
39
namespace
makVrv
40
{
45
class
DT_DLL_VRVUTIL
DtProfileSample
46
{
47
public
:
49
DtProfileSample
(
const
char
*
name
)
50
{
51
DtProfileManager::startProfile
( name );
52
}
53
55
~
DtProfileSample
( )
56
{
57
DtProfileManager::stopProfile
();
58
}
59
};
60
65
template
<
bool
Enabled>
66
struct
DtProfileTarget
67
{
68
DtProfileTarget
(
const
char
*
name
) {}
69
};
70
71
template
<>
72
struct
DtProfileTarget
<true>
73
{
75
DtProfileTarget
(
const
char
*
name
)
76
{
77
DtProfileManager::startProfile
( name );
78
}
79
81
~
DtProfileTarget
( )
82
{
83
DtProfileManager::stopProfile
();
84
}
85
};
86
91
class
DT_DLL_VRVUTIL
DtPerfomanceStatSample
92
{
93
public
:
95
DtPerfomanceStatSample
(
const
char
*
name
)
96
{
97
DtProfileManager::startPerformanceStat
( name );
98
}
99
101
~
DtPerfomanceStatSample
( )
102
{
103
DtProfileManager::stopPerformanceStat
();
104
}
105
};
106
}
107
Copyright © 2005-2013 VT MÄK. All Rights Reserved (
www.mak.com
)