HDK
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
UT_CumulativeTimer.h
Go to the documentation of this file.
1
/*
2
* PROPRIETARY INFORMATION. This software is proprietary to
3
* Side Effects Software Inc., and is not to be reproduced,
4
* transmitted, or disclosed in any way without written permission.
5
*
6
* NAME: UT_CumulativeTimer.h ( UT Library, C++)
7
*
8
* Measures the amount of time between start() and stop() calls,
9
* accumulating the time in a threadsafe manner.
10
*/
11
#ifndef UT_CumulativeTimer_H
12
#define UT_CumulativeTimer_H
13
14
#include "
UT_String.h
"
15
#include "
UT_SpinLock.h
"
16
#include "
UT_StopWatch.h
"
17
#include "
UT_ThreadSpecificValue.h
"
18
19
20
class
UT_API
UT_CumulativeTimer
21
{
22
public
:
23
UT_CumulativeTimer
(
const
char
*
name
,
bool
report_on_destroy =
false
);
24
~
UT_CumulativeTimer
();
25
26
// Print the time when this object is destroyed if true.
27
void
reportWhenDestroyed(
bool
report =
true
);
28
29
// Start and stop the timer. Can be used safely in multiple threads
30
// simultaneously.
31
void
start
();
32
void
stop();
33
34
// Reset accumulated time to zero.
35
void
reset
();
36
37
const
char
*
getName
()
const
;
38
39
// Total time between all threads.
40
double
getTime()
const
;
41
42
// Time when more than one thread is timing at once.
43
double
getOverlapTime()
const
;
44
45
// Wall clock time, from the time the first thread starts, til the time
46
// the last ends.
47
double
getTotalTime()
const
;
48
49
private
:
50
UT_String
myName;
51
52
// Per-thread timing state.
53
UT_ThreadSpecificValue<UT_StopWatch>
myTimer;
54
UT_ThreadSpecificValue<int>
myRunning;
55
UT_StopWatch
myOverlapTimer;
56
UT_StopWatch
myTotalTimer;
57
58
// A spin lock is used because the critical sections are extremely short.
59
UT_SpinLock
myLock;
60
61
// Total time for all threads
62
double
myTime;
63
double
myOverlapTime;
64
double
myTotalTime;
65
int
myTimingCount;
66
bool
myReportOnDestroy;
67
};
68
69
70
#endif
start
GLuint start
Definition:
glcorearb.h:475
UT_API
#define UT_API
Definition:
UT_API.h:14
UT_SpinLockT< false, false >
UT_String.h
reset
GLboolean reset
Definition:
glad.h:5138
PXL_OCIO::getName
PXL_API const char * getName(const ColorSpace *space)
Return the name of the color space.
UT_ThreadSpecificValue.h
name
GLuint const GLchar * name
Definition:
glcorearb.h:786
UT_StopWatch
Definition:
UT_StopWatch.h:23
UT_SpinLock.h
UT_CumulativeTimer
Definition:
UT_CumulativeTimer.h:20
UT_String
Definition:
UT_String.h:73
UT_StopWatch.h
UT_ThreadSpecificValue< UT_StopWatch >
UT
UT_CumulativeTimer.h
Generated on Tue Dec 17 2024 03:42:08 for HDK by
1.8.6