VR-Forces 4.5 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
vrfutil
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
{
38
class
DT_DLL_vrfutil
DtProfileSample
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
;
53
const
DtProfileNode::Attributes
attr
;
54
DtProfileTimestamp
start
;
55
};
56
61
template
<
bool
Enabled>
62
class
DtProfileTarget
63
{
64
public
:
65
explicit
DtProfileTarget
(
66
const
char
* name = 0,
67
DtProfileNode::Attributes
=
DtProfileNode::ENONE
) {}
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,
79
DtProfileNode::Attributes
attr =
DtProfileNode::ENONE
)
80
:
DtProfileSample
(name, attr) { }
81
};
82
}
83
Document ID: Generated on Thu Mar 23 18:54:12 EDT 2017 from SVN revision 174804
Copyright © 2005-2017 VT MÄK. All Rights Reserved (
www.mak.com
)