TexGen
Core
ShinyData.h
Go to the documentation of this file.
1
/*
2
The zlib/libpng License
3
4
Copyright (c) 2007 Aidin Abedi (www.*)
5
6
This software is provided 'as-is', without any express or implied warranty. In no event will
7
the authors be held liable for any damages arising from the use of this software.
8
9
Permission is granted to anyone to use this software for any purpose, including commercial
10
applications, and to alter it and redistribute it freely, subject to the following
11
restrictions:
12
13
1. The origin of this software must not be misrepresented; you must not claim that
14
you wrote the original software. If you use this software in a product,
15
an acknowledgment in the product documentation would be appreciated but is
16
not required.
17
18
2. Altered source versions must be plainly marked as such, and must not be
19
misrepresented as being the original software.
20
21
3. This notice may not be removed or altered from any source distribution.
22
*/
23
24
#ifndef SHINY_DATA_H
25
#define SHINY_DATA_H
26
27
#include "
ShinyPrereqs.h
"
28
29
namespace
Shiny
{
30
31
32
//-----------------------------------------------------------------------------
33
34
struct
ProfileLastData
{
35
uint32_t
entryCount
;
36
tick_t
selfTicks
;
37
};
38
39
40
//-----------------------------------------------------------------------------
41
42
struct
ProfileData
{
43
44
template
<
typename
T>
45
struct
Data
{
46
T
cur
;
47
float
avg
;
48
49
void
computeAverage
(
float
a_damping) {
avg
= a_damping * (
avg
-
cur
) +
cur
; }
50
void
clear
(
void
) {
cur
= 0;
avg
= 0; }
51
};
52
53
54
Data<uint32_t>
entryCount
;
55
Data<tick_t>
selfTicks
;
56
Data<tick_t>
childTicks
;
57
58
59
tick_t
totalTicksCur
(
void
)
const
{
return
selfTicks
.cur +
childTicks
.cur; }
60
float
totalTicksAvg
(
void
)
const
{
return
selfTicks
.avg +
childTicks
.avg; }
61
62
void
computeAverage
(
float
a_damping) {
63
entryCount
.computeAverage(a_damping);
64
selfTicks
.computeAverage(a_damping);
65
childTicks
.computeAverage(a_damping);
66
}
67
68
void
clearAll
(
void
) {
69
entryCount
.clear();
70
selfTicks
.clear();
71
childTicks
.clear();
72
}
73
74
void
clearCurrent
(
void
) {
75
entryCount
.cur = 0;
76
selfTicks
.cur = 0;
77
childTicks
.cur = 0;
78
}
79
};
80
81
82
}
// namespace Shiny
83
84
#endif
// ifndef SHINY_*_H
ShinyPrereqs.h
Shiny
Definition:
ShinyData.h:29
Shiny::tick_t
uint64_t tick_t
Definition:
ShinyPrereqs.h:77
Shiny::ProfileData::Data
Definition:
ShinyData.h:45
Shiny::ProfileData::Data::cur
T cur
Definition:
ShinyData.h:46
Shiny::ProfileData::Data::computeAverage
void computeAverage(float a_damping)
Definition:
ShinyData.h:49
Shiny::ProfileData::Data::avg
float avg
Definition:
ShinyData.h:47
Shiny::ProfileData::Data::clear
void clear(void)
Definition:
ShinyData.h:50
Shiny::ProfileData
Definition:
ShinyData.h:42
Shiny::ProfileData::totalTicksCur
tick_t totalTicksCur(void) const
Definition:
ShinyData.h:59
Shiny::ProfileData::computeAverage
void computeAverage(float a_damping)
Definition:
ShinyData.h:62
Shiny::ProfileData::clearCurrent
void clearCurrent(void)
Definition:
ShinyData.h:74
Shiny::ProfileData::totalTicksAvg
float totalTicksAvg(void) const
Definition:
ShinyData.h:60
Shiny::ProfileData::clearAll
void clearAll(void)
Definition:
ShinyData.h:68
Shiny::ProfileData::childTicks
Data< tick_t > childTicks
Definition:
ShinyData.h:56
Shiny::ProfileData::selfTicks
Data< tick_t > selfTicks
Definition:
ShinyData.h:55
Shiny::ProfileData::entryCount
Data< uint32_t > entryCount
Definition:
ShinyData.h:54
Shiny::ProfileLastData
Definition:
ShinyData.h:34
Shiny::ProfileLastData::selfTicks
tick_t selfTicks
Definition:
ShinyData.h:36
Shiny::ProfileLastData::entryCount
uint32_t entryCount
Definition:
ShinyData.h:35
Generated by
1.9.2