VR-Vantage 2.5 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) 2019 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
// 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
;
40
const
bool
Profile_DtSurfaceClampingUpdater
=
false
;
41
const
bool
Profile_DtOsgCullVisitor
=
false
;
42
43
namespace
makVrv
44
{
49
class
DT_DLL_VRVUTIL
DtProfileSample
50
{
51
public
:
53
DtProfileSample
(
const
char
*
name
)
54
{
55
DtProfileManager::startProfile
( name );
56
}
57
59
~
DtProfileSample
( )
60
{
61
DtProfileManager::stopProfile
();
62
}
63
};
64
69
template
<
bool
Enabled>
70
struct
DtProfileTarget
71
{
72
DtProfileTarget
(
const
char
*
name
) {}
73
};
74
75
template
<>
76
struct
DtProfileTarget
<true>
77
{
79
DtProfileTarget
(
const
char
*
name
)
80
{
81
DtProfileManager::startProfile
( name );
82
}
83
85
~
DtProfileTarget
( )
86
{
87
DtProfileManager::stopProfile
();
88
}
89
};
90
95
class
DT_DLL_VRVUTIL
DtPerfomanceStatSample
96
{
97
public
:
99
DtPerfomanceStatSample
(
const
char
*
name
)
100
{
101
DtProfileManager::startPerformanceStat
( name );
102
}
103
105
~
DtPerfomanceStatSample
( )
106
{
107
DtProfileManager::stopPerformanceStat
();
108
}
109
};
110
}
111
Copyright © 2005-2019 VT MAK. All Rights Reserved (
www.mak.com
)