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
BRAY_Stats.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: BRAY_Stats.h (BRAY Library, C++)
7
*
8
* COMMENTS:
9
*/
10
11
#ifndef __BRAY_Stats__
12
#define __BRAY_Stats__
13
14
#include "
BRAY_API.h
"
15
#include "
BRAY_Types.h
"
16
#include <
UT/UT_UniquePtr.h
>
17
#include <
UT/UT_Rect.h
>
18
#include <
UT/UT_NonCopyable.h
>
19
#include <
UT/UT_StringHolder.h
>
20
#include <
UT/UT_JSONValue.h
>
21
22
class
BRAY_StatsImpl;
23
class
BRAY_Renderer;
24
25
namespace
BRAY
26
{
27
28
class
BRAY_API
Stats
29
:
UT_NonCopyable
30
{
31
public
:
32
Stats
(
const
BRAY_Renderer &renderer);
33
~
Stats
();
34
35
enum
Key
36
{
37
// System information
38
USERNAME
,
// User name
39
HOSTNAME
,
// Host name
40
KARMA_VERSION
,
// Karma version
41
SYSTEM_THREADS
,
// Thread count
42
SYSTEM_CPU_BRAND
,
// CPU brand
43
SYSTEM_CPU_ARCHITECTURE
,
// CPU architecture
44
SYSTEM_MEMORY
,
// Current system memory usage
45
SYSTEM_TIME
,
// Current system times
46
SYSTEM_RESOURCE_USAGE
,
// Current system resource usage
47
48
// Global render state
49
ENGINE
,
// Rendering engine (cpu or xpu)
50
XPU_DEVICE_COUNT
,
// XPU device count
51
52
RENDER_SETTINGS
,
// JSON string of all global render settings
53
54
RENDER_CAMERA
,
// Path to render camera
55
DICING_CAMERA
,
// Path to dicing camera
56
RESOLUTION
,
// Image resoution
57
58
WORLD_TO_CAMERA
,
// World to camera transform
59
WORLD_TO_SCREEN
,
// World to screen transform
60
WORLD_TO_NDC
,
// World to NDC transform
61
WORLD_TO_RASTER
,
// World to raster space transform
62
63
CAMERA_NEAR_FAR
,
// Camera near/far clipping planes
64
65
AOV_BUFFERS
,
// AOV Buffer dictionary
66
AOV_RASTER_MEMORY
,
// Current/Peak memory used by rasters
67
DEEP_IMAGE_MEMORY
,
// Current/peak deep memory
68
69
// Texture information
70
UNIFIED_CACHE
,
// Unified cache information
71
TEXTURE_ERROR_FILES
,
// List of bad texture paths
72
TEXTURE_CONVERSIONS
,
// Textures converted interanally
73
74
RAT_STATS
,
// Number of .rat textures
75
RAT_DISK_CACHE
,
// RAT file disk cache performance
76
RAT_DISK_CACHE_ERRORS
,
// RAT file disk cache conversions
77
78
OIIO_STATS
,
// OIIO texture stats
79
OIIO_STATS_STRING
,
// OIIO stats string (direct from OIIO)
80
81
PTEX_STATS
,
// Ptex texture stats
82
83
// USD information
84
OBJECT_COUNTS
,
// Object counts in the scene
85
GEOMETRY_COUNTS
,
// Geometry prim counts in the scene
86
LIGHT_TYPES
,
// Counts for different light types
87
PRIMVAR_CACHE
,
// Information about primvar cache
88
89
// Rendering state information
90
PERCENT_COMPLETE
,
// Percent complete (0-1)
91
RENDER_STAGE
,
// Stage of rendering (inactive, loading, etc.)
92
RENDER_STAGE_LABEL
,
// Stage of rendering (inactive, loading, etc.)
93
LOAD_TIME
,
// Time to load scene
94
LOAD_MEMORY
,
// Memory after load
95
TTFP
,
// Time to first pixel
96
FILTER_ERRORS
,
// Errors in pixel/image filters (denoisers)
97
98
// Karma CPU
99
SHADER_CALLS
,
// Number of shader calls
100
SHADER_NODES
,
// Number of shader graph nodes
101
RAY_COUNTS
,
// Primary, indirect, occlusion, etc.
102
TIMINGS
,
// Breakdown of time
103
104
// Karma XPU
105
XPU_COMPILES
,
// XPU compile information
106
XPU_TIMINGS
,
// XPU-specific timings
107
108
STOCHASTIC_DEPTH
,
// Depth of stochastic transparency
109
RAY_DEPTHS
,
// Distribution of ray-depths
110
RAY_DEPTHS_PERCENTAGE
,
// Distribution of ray-depths
111
RAY_BATCH_EFFICIENCY
,
// Batch efficiency
112
113
// Checkpointing
114
CHECKPOINT_STATS
,
// Checkpoint stats
115
116
// Render progress
117
ACTIVE_BUCKETS
,
// Active buckets list
118
119
// Annoatations (backward compatibility)
120
PROGRESS_ANNOTATION
,
// Progress
121
STATS_ANNOTATION
,
// XPU Stats
122
123
MAX_KEYS
// Sentinal
124
};
125
126
enum
DeviceKey
127
{
128
DEVICE_LABEL
,
// Label for the device
129
DEVICE_TYPE
,
// Type of device (gpu, embree)
130
DEVICE_STATUS
,
// Device status
131
DEVICE_ERROR
,
// Device error message
132
DEVICE_MEMORY
,
// Breakdown of memory
133
DEVICE_SAMPLES
,
// Number of samples processed by device
134
DEVICE_CONTRIB
,
// Contribution of device
135
136
DEVICE_MAX_KEYS
// Sentinal
137
};
138
139
struct
BRAY_API
Value
140
:
public
UT_NonCopyable
141
{
142
Value
(BRAY_StatsImpl &stats,
Key
key);
143
Value(BRAY_StatsImpl &stats,
DeviceKey
key,
int
device);
144
~Value();
145
146
SYS_SAFE_BOOL
operator
bool()
const
147
{
148
return
myValue.getType() !=
UT_JSONValue::JSON_NULL
;
149
}
150
151
const
UT_JSONValue
&
get
()
const
{
return
myValue; }
152
const
UT_JSONValue
&
operator->
()
const
{
return
myValue; }
153
const
UT_JSONValue
&
operator*
()
const
{
return
myValue; }
154
155
const
UT_StringHolder
&key()
const
;
156
UT_StringHolder
asString()
const
;
157
private
:
158
const
UT_JSONValue
&myValue;
159
BRAY_StatsImpl &myStats;
160
int
myDevice;
161
Key
myKey;
162
DeviceKey
myDeviceKey;
163
};
164
165
static
const
UT_StringHolder
&keyName(Key key);
166
static
const
UT_StringHolder
&deviceKeyName(DeviceKey key);
167
168
/// Lightweight method to get the render stage
169
BRAY_RenderStage
renderStage()
const
;
170
/// Lightweight method to get the percent complete (between 0 and 100)
171
fpreal
percentComplete()
const
;
172
173
/// Get the value of the stat
174
Value
get
(
Key
key)
const
175
{
return
Value
(*myImpl, key); }
176
177
/// Get the value of the device stat
178
Value
get
(
DeviceKey
key,
int
device)
const
179
{
return
Value
(*myImpl, key, device); }
180
181
/// After XPU devices are initialized, call this method to configure the
182
/// stats.
183
void
initDevices();
184
185
/// Clear for next render
186
void
clear();
187
188
/// @{
189
/// @private - methods used by the renderer to update stats during rendering
190
BRAY_RenderStage
setStage(
BRAY_RenderStage
s
);
191
void
setPercentDone(
fpreal
v
);
192
void
setTTFP(
fpreal
v
);
193
void
setProgressAnnotation(
const
UT_StringHolder
&
s
);
194
void
setStatsAnnotation(
const
UT_StringHolder
&
s
);
195
void
setAnnotations(
const
UT_StringHolder
&progress_annotation,
196
const
UT_StringHolder
&stats_annotation);
197
void
startBucket(
const
UT_DimRect
&bounds,
int
pass);
198
void
endBucket();
199
200
struct
AutoBucket
201
{
202
AutoBucket
(
Stats
&stats,
const
UT_DimRect
&bounds,
int
pass)
203
: myStats(stats)
204
{
205
myStats.startBucket(bounds, pass);
206
}
207
~AutoBucket
()
208
{
209
myStats.endBucket();
210
}
211
Stats
&
myStats
;
212
};
213
/// @}
214
215
private
:
216
UT_UniquePtr<BRAY_StatsImpl>
myImpl;
217
};
218
219
}
// End namespace
220
221
#endif
222
BRAY::Stats::RENDER_SETTINGS
Definition:
BRAY_Stats.h:52
BRAY::Stats::SYSTEM_MEMORY
Definition:
BRAY_Stats.h:44
BRAY_Types.h
BRAY::Stats::DEVICE_SAMPLES
Definition:
BRAY_Stats.h:133
BRAY::Stats::Value::operator*
const UT_JSONValue & operator*() const
Definition:
BRAY_Stats.h:153
BRAY::Stats::WORLD_TO_SCREEN
Definition:
BRAY_Stats.h:59
BRAY::Stats::HOSTNAME
Definition:
BRAY_Stats.h:39
BRAY::Stats::PTEX_STATS
Definition:
BRAY_Stats.h:81
v
const GLdouble * v
Definition:
glcorearb.h:837
BRAY::Stats::WORLD_TO_RASTER
Definition:
BRAY_Stats.h:61
BRAY::Stats::SHADER_NODES
Definition:
BRAY_Stats.h:100
BRAY::Stats::CHECKPOINT_STATS
Definition:
BRAY_Stats.h:114
BRAY::Stats::DeviceKey
DeviceKey
Definition:
BRAY_Stats.h:126
UT_Rect.h
BRAY::Stats::FILTER_ERRORS
Definition:
BRAY_Stats.h:96
BRAY::Stats::SYSTEM_THREADS
Definition:
BRAY_Stats.h:41
BRAY::Stats::RENDER_STAGE_LABEL
Definition:
BRAY_Stats.h:92
BRAY::Stats::RAT_DISK_CACHE
Definition:
BRAY_Stats.h:75
s
GLdouble s
Definition:
glad.h:3009
BRAY::Stats::AOV_BUFFERS
Definition:
BRAY_Stats.h:65
BRAY::Stats::DEVICE_ERROR
Definition:
BRAY_Stats.h:131
UT_JSONValue.h
BRAY::Stats::WORLD_TO_CAMERA
Definition:
BRAY_Stats.h:58
BRAY::Stats::PRIMVAR_CACHE
Definition:
BRAY_Stats.h:87
BRAY::Stats::RESOLUTION
Definition:
BRAY_Stats.h:56
BRAY::Stats::DICING_CAMERA
Definition:
BRAY_Stats.h:55
BRAY::Stats::DEVICE_CONTRIB
Definition:
BRAY_Stats.h:134
BRAY::Stats::ENGINE
Definition:
BRAY_Stats.h:49
UT_UniquePtr
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
Definition:
UT_UniquePtr.h:39
BRAY::Stats::UNIFIED_CACHE
Definition:
BRAY_Stats.h:70
BRAY::Stats::RAY_DEPTHS_PERCENTAGE
Definition:
BRAY_Stats.h:110
BRAY::Stats::Value
Definition:
BRAY_Stats.h:139
UT_StringHolder
Definition:
UT_StringHolder.h:999
BRAY::Stats::STOCHASTIC_DEPTH
Definition:
BRAY_Stats.h:108
BRAY_RenderStage
BRAY_RenderStage
Definition:
BRAY_Types.h:592
SYS_SAFE_BOOL
#define SYS_SAFE_BOOL
Definition:
SYS_Compiler.h:55
BRAY::Stats::LOAD_MEMORY
Definition:
BRAY_Stats.h:94
BRAY::Stats::DEVICE_TYPE
Definition:
BRAY_Stats.h:129
BRAY::Stats::AutoBucket::myStats
Stats & myStats
Definition:
BRAY_Stats.h:211
BRAY::Stats::CAMERA_NEAR_FAR
Definition:
BRAY_Stats.h:63
BRAY::Stats::TEXTURE_CONVERSIONS
Definition:
BRAY_Stats.h:72
BRAY::Stats::LIGHT_TYPES
Definition:
BRAY_Stats.h:86
BRAY::Stats::RAT_DISK_CACHE_ERRORS
Definition:
BRAY_Stats.h:76
BRAY::Stats::RAT_STATS
Definition:
BRAY_Stats.h:74
BRAY::Stats::AOV_RASTER_MEMORY
Definition:
BRAY_Stats.h:66
BRAY::Stats::SYSTEM_CPU_BRAND
Definition:
BRAY_Stats.h:42
UT_NonCopyable.h
BRAY::Stats::DEVICE_STATUS
Definition:
BRAY_Stats.h:130
BRAY::Stats
Definition:
BRAY_Stats.h:28
UT_JSONValue::JSON_NULL
Definition:
UT_JSONValue.h:105
BRAY::Stats::TEXTURE_ERROR_FILES
Definition:
BRAY_Stats.h:71
BRAY::Stats::RAY_COUNTS
Definition:
BRAY_Stats.h:101
BRAY::Stats::RAY_BATCH_EFFICIENCY
Definition:
BRAY_Stats.h:111
BRAY::Stats::TTFP
Definition:
BRAY_Stats.h:95
BRAY::Stats::ACTIVE_BUCKETS
Definition:
BRAY_Stats.h:117
BRAY::Stats::DEVICE_MEMORY
Definition:
BRAY_Stats.h:132
BRAY::Stats::SYSTEM_RESOURCE_USAGE
Definition:
BRAY_Stats.h:46
BRAY::Stats::AutoBucket
Definition:
BRAY_Stats.h:200
BRAY::Stats::TIMINGS
Definition:
BRAY_Stats.h:102
BRAY::Stats::XPU_DEVICE_COUNT
Definition:
BRAY_Stats.h:50
BRAY::Stats::AutoBucket::AutoBucket
AutoBucket(Stats &stats, const UT_DimRect &bounds, int pass)
Definition:
BRAY_Stats.h:202
BRAY::Stats::XPU_COMPILES
Definition:
BRAY_Stats.h:105
BRAY_API.h
UT_UniquePtr.h
UT_Rect< UT_DimRectImpl >
BRAY::Stats::WORLD_TO_NDC
Definition:
BRAY_Stats.h:60
BRAY::Stats::LOAD_TIME
Definition:
BRAY_Stats.h:93
UT_StringHolder.h
fpreal
fpreal64 fpreal
Definition:
SYS_Types.h:277
BRAY::Stats::USERNAME
Definition:
BRAY_Stats.h:38
BRAY::Stats::GEOMETRY_COUNTS
Definition:
BRAY_Stats.h:85
BRAY::Stats::DEVICE_LABEL
Definition:
BRAY_Stats.h:128
BRAY::Stats::XPU_TIMINGS
Definition:
BRAY_Stats.h:106
BRAY::Stats::OIIO_STATS
Definition:
BRAY_Stats.h:78
BRAY::Stats::RENDER_CAMERA
Definition:
BRAY_Stats.h:54
BRAY::Stats::PROGRESS_ANNOTATION
Definition:
BRAY_Stats.h:120
BRAY::Stats::OBJECT_COUNTS
Definition:
BRAY_Stats.h:84
BRAY_API
#define BRAY_API
Definition:
BRAY_API.h:12
UT_NonCopyableNS::UT_NonCopyable
Definition:
UT_NonCopyable.h:17
UT_JSONValue
Class to store JSON objects as C++ objects.
Definition:
UT_JSONValue.h:99
BRAY::Stats::STATS_ANNOTATION
Definition:
BRAY_Stats.h:121
BRAY::Stats::DEEP_IMAGE_MEMORY
Definition:
BRAY_Stats.h:67
BRAY::Stats::PERCENT_COMPLETE
Definition:
BRAY_Stats.h:90
BRAY::Stats::SYSTEM_CPU_ARCHITECTURE
Definition:
BRAY_Stats.h:43
BRAY::Stats::OIIO_STATS_STRING
Definition:
BRAY_Stats.h:79
BRAY::Stats::AutoBucket::~AutoBucket
~AutoBucket()
Definition:
BRAY_Stats.h:207
BRAY::Stats::Key
Key
Definition:
BRAY_Stats.h:35
BRAY::Stats::SYSTEM_TIME
Definition:
BRAY_Stats.h:45
BRAY::Stats::RAY_DEPTHS
Definition:
BRAY_Stats.h:109
BRAY::Stats::Value::operator->
const UT_JSONValue & operator->() const
Definition:
BRAY_Stats.h:152
BRAY::Stats::SHADER_CALLS
Definition:
BRAY_Stats.h:99
BRAY::Stats::RENDER_STAGE
Definition:
BRAY_Stats.h:91
BRAY::Stats::KARMA_VERSION
Definition:
BRAY_Stats.h:40
BRAY
BRAY_Stats.h
Generated on Sat Feb 15 2025 02:46:34 for HDK by
1.8.6