VR-Link API Documentation for HLA 1.3
Home
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
vlutil
vlPerformanceStats.h
Go to the documentation of this file.
1
/******************************************************************************
2
** Copyright (c) 1992-2010 VT MAK
3
** All rights reserved.
4
******************************************************************************/
10
#pragma once
11
12
#include "
vlUtil.h
"
13
#include <vector>
14
15
#ifdef _WIN32
16
#else
17
#include <sys/time.h>
18
#endif
19
20
#ifdef DtUSE_UTILITIES_NAMESPACE
21
namespace
DtUSE_UTILITIES_NAMESPACE
22
{
23
#endif
24
32
class
DT_DLL_VLUTIL
DtTimedSection
33
{
34
public
:
36
DtTimedSection
();
37
39
virtual
void
start();
40
42
virtual
void
stop();
43
49
virtual
double
duration()
const
;
50
51
protected
:
52
53
//Platform specific storage times, and additional members.
54
#ifdef _WIN32
55
typedef
LARGE_INTEGER
TimeValue
;
56
double
myInverseFrequency;
57
#else
58
typedef
timeval
TimeValue
;
59
struct
timezone tz;
60
#endif
61
62
TimeValue
myStartVal
;
63
TimeValue
myEndVal
;
64
};
65
66
class
DT_DLL_VLUTIL
DtTimedLappingSection
:
public
DtTimedSection
67
{
68
public
:
69
71
DtTimedLappingSection
();
72
74
virtual
void
lap();
75
77
virtual
double
durationSegment(
const
unsigned
int
& lapReference )
const
;
78
80
virtual
unsigned
int
getCurrentLap()
const
;
81
protected
:
82
83
// this stores a vector of all the time lapses
84
std::vector< TimeValue >
myLapValues
;
85
86
// the current lap
87
unsigned
int
myCurrentLap
;
88
};
89
99
class
DT_DLL_VLUTIL
DtTimeStatistic
100
{
101
public
:
102
104
DtTimeStatistic
();
105
107
void
addTime(
double
time);
108
110
inline
double
last()
const
111
{
112
return
myLastTime;
113
}
114
116
inline
double
minimum()
const
117
{
118
return
myMinimum;
119
}
120
123
inline
double
avg()
const
124
{
125
// Calculate the average by taking the running Avg scaled by the max
126
// count plus the current average scaled by the count/ over the total count;
127
return
(myLastSum + mySum) / (
double
)(myLastCount + myCount);
128
}
129
131
inline
double
maximum()
const
132
{
133
return
myMaximum;
134
}
135
137
void
reset();
138
139
protected
:
140
double
myLastTime
;
141
double
myMinimum
;
142
double
mySum
;
143
double
myLastSum
;
144
double
myMaximum
;
145
unsigned
int
myCount
;
146
unsigned
int
myLastCount
;
147
static
const
int
theMaxCount = 1000;
148
};
149
157
class
DT_DLL_VLUTIL
DtPerformanceStats
158
{
159
public
:
160
//A vector of stats.
161
typedef
std::vector<DtTimeStatistic>
TimeStats
;
162
163
//Create a time stat list.
164
DtPerformanceStats
();
165
166
//Destroy a time stat list.
167
~
DtPerformanceStats
();
168
170
void
resetAllStats();
171
173
inline
void
addTime(
unsigned
int
id
,
double
time)
174
{
175
stat(
id
).addTime(time);
176
}
177
179
inline
double
last(
unsigned
int
id
)
const
180
{
181
return
stat(
id
).last();
182
}
183
185
inline
double
minimum(
unsigned
int
id
)
const
186
{
187
return
stat(
id
).minimum();
188
}
189
191
inline
double
avg(
unsigned
int
id
)
const
192
{
193
return
stat(
id
).avg();
194
}
195
197
inline
double
maximum(
unsigned
int
id
)
const
198
{
199
return
stat(
id
).maximum();
200
}
201
210
DtTimeStatistic
& stat(
unsigned
int
statEnumIndex);
211
const
DtTimeStatistic
& stat(
unsigned
int
statEnumIndex)
const
;
212
214
215
TimeStats& stats();
216
const
TimeStats& stats()
const
;
218
219
protected
:
220
TimeStats
myStats
;
221
};
222
223
#ifdef DtUSE_UTILITIES_NAMESPACE
224
}
225
#endif
226
Document ID: Generated on Thu Feb 22 04:26:36 EST 2018 from SVN revision 186468
Copyright © 2005-2016 VT MÄK. All Rights Reserved (
www.mak.com
)