VR-Forces Development_Version 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
profileNode.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
15
#include "
vrfutil/columnLogger.h
"
16
17
#include <tbb/tick_count.h>
18
#include <tbb/spin_mutex.h>
19
#include <tbb/spin_rw_mutex.h>
20
#include <tbb/atomic.h>
21
22
#include <iosfwd>
23
24
namespace
makVrf
25
{
26
class
DtProfileManager;
27
28
typedef
unsigned
long
long
DtUInt64
;
29
31
struct
DT_DLL_vrfutil
DtProfileStat
32
{
33
DtUInt64
instructions
;
34
double
time
;
35
37
DtProfileStat
();
38
40
void
reset();
41
43
double
instructionsPerSecond()
const
;
44
46
DtProfileStat
& operator+=(
const
DtProfileStat
&);
47
49
template
<
typename
T>
50
DtProfileStat
operator/(
const
T& val)
const
51
{
52
DtProfileStat
stat(*
this
);
53
stat.
instructions
/= val;
54
stat.
time
/= val;
55
return
stat;
56
}
57
};
58
60
struct
DT_DLL_vrfutil
DtProfileTimestamp
61
{
63
static
DtProfileTimestamp
Now();
64
66
DtProfileTimestamp
();
67
69
DtProfileStat
operator-(
const
DtProfileTimestamp
&)
const
;
70
71
DtUInt64
instructionCount
;
72
tbb::tick_count
timestamp
;
73
};
74
77
class
DT_DLL_vrfutil
DtProfileNode
78
{
79
public
:
80
enum
Attributes
81
{
82
ENONE = 0,
83
EVIRTUAL = 1,
84
EINVISIBLE = 2,
85
ENODE = 3
86
};
87
89
DtProfileNode
(
90
const
char
* name,
91
DtProfileManager
* mgr,
92
DtProfileNode
* parent,
93
Attributes attr);
94
96
~
DtProfileNode
();
97
101
DtProfileNode
* getChildNode(
const
char
*, Attributes attr = ENONE);
102
103
bool
isVirtual
()
const
{
return
((myAttributes & EVIRTUAL) != 0); }
104
bool
isInvisible
()
const
{
return
((myAttributes & EINVISIBLE) != 0); }
105
107
DtProfileNode
*
parent
()
const
{
return
myParent; }
109
DtProfileNode
*
sibling
()
const
{
return
mySibling; }
111
DtProfileNode
*
child
()
const
{
return
myChild; }
112
114
void
reset();
115
117
const
char
*
name
()
const
{
return
myName; }
119
int
totalCalls
()
const
{
return
myTotalCalls; }
121
DtProfileStat
totalTime
()
const
{
return
myTotalTime; }
123
DtProfileStat
timeLastFrame()
const
;
125
unsigned
nestingLevel
()
const
{
return
myNestingLevel; }
126
127
void
nextFrame();
128
129
protected
:
130
friend
class
DtProfileManager
;
131
133
DtProfileTimestamp
call();
137
bool
finish(
const
DtProfileTimestamp
& start);
138
139
DtProfileManager
*
myManager
;
140
141
const
char
*
myName
;
142
143
144
typedef
tbb::spin_mutex
StatMutex
;
145
mutable
StatMutex
myStatMutex
;
146
DtProfileStat
myTotalTime
;
147
DtProfileStat
myTimeLastFrame
;
148
150
tbb::atomic<int>
myTotalCalls
;
151
tbb::atomic<int>
myTotalCallsThisFrame
;
152
//int myRecursionCounter; //! current recursion level
153
154
typedef
tbb::spin_rw_mutex
Mutex
;
155
mutable
Mutex
myMutex
;
156
158
DtProfileNode
*
myParent
;
159
DtProfileNode
*
myLogParent
;
160
DtProfileNode
*
myLogRoot
;
161
DtProfileNode
*
myChild
;
162
DtProfileNode
*
mySibling
;
163
unsigned
myNestingLevel
;
164
165
Attributes
myAttributes
;
166
168
DtColumnLogger::Column
*
myParentColumn
;
169
DtColumnLogger::Column
*
myTimeColumn
;
170
DtColumnLogger::Column
*
myInstColumn
;
171
DtColumnLogger::Column
*
myRateColumn
;
172
};
173
}
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
)