28 static const int current_pstat_major_version = 3;
29 static const int current_pstat_minor_version = 0;
44 return current_pstat_major_version;
57 return current_pstat_minor_version;
80 struct TimeCollectorProperties {
84 double suggested_scale;
87 struct LevelCollectorProperties {
92 double suggested_scale;
96 static TimeCollectorProperties time_properties[] = {
97 { 1,
"Frame", { 0.95, 1.0, 0.35 } },
98 { 1,
"Wait", { 0.6, 0.6, 0.6 } },
99 { 0,
"Wait:Mutex block", { 0.5, 0.0, 1.0 } },
100 { 1,
"Wait:Thread sync", { 0.0, 1.0, 0.5 } },
101 { 1,
"Wait:Clock Wait", { 0.2, 0.8, 0.2 } },
102 { 1,
"Wait:Clock Wait:Sleep", { 0.9, 0.4, 0.8 } },
103 { 1,
"Wait:Clock Wait:Spin", { 0.2, 0.8, 1.0 } },
104 { 1,
"Wait:Flip", { 1.0, 0.6, 0.3 } },
105 { 1,
"Wait:Flip:Begin", { 0.3, 0.3, 0.9 } },
106 { 1,
"Wait:Flip:End", { 0.9, 0.3, 0.6 } },
107 { 1,
"App", { 0.0, 0.4, 0.8 }, 1.0 / 30.0 },
108 { 1,
"App:Collisions", { 1.0, 0.5, 0.0 } },
109 { 1,
"App:Collisions:Reset", { 0.0, 0.0, 0.5 } },
110 { 0,
"App:Data graph", { 0.5, 0.8, 0.4 } },
111 { 1,
"App:Show code", { 0.8, 0.2, 1.0 } },
112 { 0,
"App:Show code:Nametags", { 0.8, 0.8, 1.0 } },
113 { 0,
"App:Show code:Nametags:2d", { 0.0, 0.0, 0.5 } },
114 { 0,
"App:Show code:Nametags:2d:Contents", { 0.0, 0.5, 0.0 } },
115 { 0,
"App:Show code:Nametags:2d:Adjust", { 0.5, 0.0, 0.5 } },
116 { 0,
"App:Show code:Nametags:3d", { 1.0, 0.0, 0.0 } },
117 { 0,
"App:Show code:Nametags:3d:Contents", { 0.0, 0.5, 0.0 } },
118 { 0,
"App:Show code:Nametags:3d:Adjust", { 0.5, 0.0, 0.5 } },
119 { 1,
"Cull", { 0.21, 0.68, 0.37 }, 1.0 / 30.0 },
120 { 1,
"Cull:Setup", { 0.7, 0.4, 0.5 } },
121 { 1,
"Cull:Sort", { 0.3, 0.3, 0.6 } },
122 { 1,
"*", { 0.1, 0.1, 0.5 } },
123 { 1,
"*:Show fps", { 0.5, 0.8, 1.0 } },
124 { 1,
"*:Munge", { 0.3, 0.3, 0.9 } },
125 { 1,
"*:Munge:Geom", { 0.4, 0.2, 0.8 } },
126 { 1,
"*:Munge:Sprites", { 0.2, 0.8, 0.4 } },
127 { 0,
"*:Munge:Data", { 0.7, 0.5, 0.2 } },
128 { 0,
"*:Munge:Rotate", { 0.9, 0.8, 0.5 } },
129 { 0,
"*:Munge:Decompose", { 0.1, 0.3, 0.1 } },
130 { 1,
"*:PStats", { 0.4, 0.8, 1.0 } },
131 { 1,
"*:Animation", { 1.0, 0.0, 1.0 } },
132 { 0,
"*:Flatten", { 0.0, 0.7, 0.4 } },
133 { 0,
"*:State Cache", { 0.4, 0.7, 0.7 } },
134 { 0,
"*:NodePath", { 0.1, 0.6, 0.8 } },
135 { 1,
"Draw", { 0.83, 0.02, 0.01 }, 1.0 / 30.0 },
136 { 1,
"Draw:Make current", { 0.4, 0.2, 0.6 } },
137 { 1,
"Draw:Copy texture", { 0.2, 0.6, 0.4 } },
138 { 1,
"Draw:Transfer data", { 0.8, 0.0, 0.6 } },
139 { 1,
"Draw:Transfer data:Vertex buffer", { 0.0, 0.1, 0.9 } },
140 { 1,
"Draw:Transfer data:Index buffer", { 0.1, 0.9, 0.0 } },
141 { 1,
"Draw:Transfer data:Texture", { 0.9, 0.0, 0.1 } },
142 { 1,
"Draw:Transfer data:Display lists", { 0.5, 0.0, 0.9 } },
143 { 1,
"Draw:Clear", { 0.0, 0.8, 0.6 } },
144 { 1,
"Draw:Flush", { 0.9, 0.2, 0.7 } },
145 { 1,
"Draw:Sync", { 0.5, 0.7, 0.7 } },
146 { 0,
"Draw:Transform", { 0.0, 0.5, 0.0 } },
147 { 1,
"Draw:Primitive", { 0.0, 0.0, 0.5 } },
148 { 1,
"Draw:Set State", { 0.2, 0.6, 0.8 } },
149 { 1,
"Draw:Wait occlusion", { 1.0, 0.5, 0.0 } },
150 { 1,
"Draw:Bind FBO", { 0.0, 0.8, 0.8 } },
154 static LevelCollectorProperties level_properties[] = {
155 { 1,
"Graphics memory", { 0.0, 0.0, 1.0 },
"MB", 64, 1048576 },
156 { 1,
"Buffer switch", { 0.0, 0.6, 0.8 },
"", 500 },
157 { 1,
"Buffer switch:Vertex", { 0.8, 0.0, 0.6 } },
158 { 1,
"Buffer switch:Index", { 0.8, 0.6, 0.3 } },
159 { 1,
"Geom cache size", { 0.6, 0.8, 0.6 },
"", 500 },
160 { 1,
"Geom cache size:Active", { 0.9, 1.0, 0.3 },
"", 500 },
161 { 1,
"Geom cache operations", { 1.0, 0.6, 0.6 },
"", 500 },
162 { 1,
"Geom cache operations:record", { 0.2, 0.4, 0.8 } },
163 { 1,
"Geom cache operations:erase", { 0.4, 0.8, 0.2 } },
164 { 1,
"Geom cache operations:evict", { 0.8, 0.2, 0.4 } },
165 { 1,
"Data transferred", { 0.0, 0.2, 0.4 },
"MB", 12, 1048576 },
166 { 1,
"Primitive batches", { 0.2, 0.5, 0.9 },
"", 500 },
167 { 1,
"Primitive batches:Other", { 0.2, 0.2, 0.2 } },
168 { 1,
"Primitive batches:Triangles", { 0.8, 0.8, 0.8 } },
169 { 1,
"Primitive batches:Triangle fans", { 0.8, 0.5, 0.2 } },
170 { 1,
"Primitive batches:Triangle strips",{ 0.2, 0.5, 0.8 } },
171 { 1,
"Primitive batches:Display lists", { 0.8, 0.5, 1.0 } },
172 { 1,
"SW Sprites", { 0.2, 0.7, 0.3 },
"K", 10, 1000 },
173 { 1,
"Vertices", { 0.5, 0.2, 0.0 },
"K", 10, 1000 },
174 { 1,
"Vertices:Other", { 0.2, 0.2, 0.2 } },
175 { 1,
"Vertices:Triangles", { 0.8, 0.8, 0.8 } },
176 { 1,
"Vertices:Triangle fans", { 0.8, 0.5, 0.2 } },
177 { 1,
"Vertices:Triangle strips", { 0.2, 0.5, 0.8 } },
178 { 1,
"Vertices:Indexed triangle strips", { 0.5, 0.2, 0.8 } },
179 { 1,
"Vertices:Display lists", { 0.8, 0.5, 1.0 } },
180 { 1,
"Vertices:Immediate mode", { 1.0, 0.5, 0.0 } },
181 { 1,
"Pixels", { 0.8, 0.3, 0.7 },
"M", 5, 1000000 },
182 { 1,
"Nodes", { 0.4, 0.2, 0.8 },
"", 500.0 },
183 { 1,
"Nodes:GeomNodes", { 0.8, 0.2, 0.0 } },
184 { 1,
"Geoms", { 0.4, 0.8, 0.3 },
"", 500.0 },
185 { 1,
"Cull volumes", { 0.7, 0.6, 0.9 },
"", 500.0 },
186 { 1,
"Cull volumes:Transforms", { 0.9, 0.6, 0.0 } },
187 { 1,
"State changes", { 1.0, 0.5, 0.2 },
"", 500.0 },
188 { 1,
"State changes:Other", { 0.2, 0.2, 0.2 } },
189 { 1,
"State changes:Transforms", { 0.2, 0.2, 0.8 } },
190 { 1,
"State changes:Textures", { 0.8, 0.2, 0.2 } },
191 { 1,
"Occlusion tests", { 0.9, 0.8, 0.3 },
"", 500.0 },
192 { 1,
"Occlusion results", { 0.3, 0.9, 0.8 },
"", 500.0 },
193 { 1,
"System memory", { 0.5, 1.0, 0.5 },
"MB", 64, 1048576 },
194 { 1,
"System memory:Heap", { 0.2, 0.2, 1.0 } },
195 { 1,
"System memory:Heap:Overhead", { 0.3, 0.4, 0.6 } },
196 { 1,
"System memory:Heap:Single", { 0.8, 0.3, 0.3 } },
197 { 1,
"System memory:Heap:Array", { 0.1, 0.3, 1.0 } },
198 { 1,
"System memory:Heap:Overhead", { 0.9, 0.7, 0.8 } },
199 { 1,
"System memory:Heap:External", { 0.2, 0.2, 0.5 } },
200 { 1,
"System memory:MMap", { 0.9, 0.4, 0.7 } },
201 { 1,
"Vertex Data", { 1.0, 0.4, 0.0 },
"MB", 64, 1048576 },
202 { 1,
"Vertex Data:Independent", { 0.9, 0.1, 0.9 } },
203 { 1,
"Vertex Data:Small", { 0.2, 0.3, 0.4 } },
204 { 1,
"Vertex Data:Pending", { 0.6, 0.8, 1.0 } },
205 { 1,
"Vertex Data:Resident", { 0.9, 1.0, 0.7 } },
206 { 1,
"Vertex Data:Compressed", { 0.5, 0.1, 0.4 } },
207 { 1,
"Vertex Data:Disk", { 0.6, 0.9, 0.1 } },
208 { 1,
"Vertex Data:Disk:Unused", { 0.8, 0.4, 0.5 } },
209 { 1,
"Vertex Data:Disk:Used", { 0.2, 0.1, 0.6 } },
210 { 1,
"TransformStates", { 1.0, 0.5, 0.5 },
"", 5000 },
211 { 1,
"TransformStates:On nodes", { 0.2, 0.8, 1.0 } },
212 { 1,
"TransformStates:Cached", { 1.0, 0.0, 0.2 } },
213 { 1,
"TransformStates:Unused", { 0.2, 0.2, 0.2 } },
214 { 1,
"RenderStates", { 0.5, 0.5, 1.0 },
"", 1000 },
215 { 1,
"RenderStates:On nodes", { 0.2, 0.8, 1.0 } },
216 { 1,
"RenderStates:Cached", { 1.0, 0.0, 0.2 } },
217 { 1,
"RenderStates:Unused", { 0.2, 0.2, 0.2 } },
218 { 1,
"PipelineCyclers", { 0.5, 0.5, 1.0 },
"", 50000 },
219 { 1,
"Dirty PipelineCyclers", { 0.2, 0.2, 0.2 },
"", 5000 },
220 { 1,
"Collision Volumes", { 1.0, 0.8, 0.5 },
"", 500 },
221 { 1,
"Collision Tests", { 0.5, 0.8, 1.0 },
"", 100 },
222 { 1,
"Command latency", { 0.8, 0.2, 0.0 },
"ms", 10, 1.0 / 1000.0 },
232 initialize_collector_def_from_table(
const string &fullname,
PStatCollectorDef *def) {
236 time_properties[i].name !=
nullptr;
238 const TimeCollectorProperties &tp = time_properties[i];
239 if (fullname == tp.name) {
241 if (!def->_active_explicitly_set) {
242 def->_is_active = tp.is_active;
244 def->_suggested_color = tp.color;
245 if (tp.suggested_scale != 0.0) {
246 def->_suggested_scale = tp.suggested_scale;
253 level_properties[i].name !=
nullptr;
255 const LevelCollectorProperties &lp = level_properties[i];
256 if (fullname == lp.name) {
258 if (!def->_active_explicitly_set) {
259 def->_is_active = lp.is_active;
261 def->_suggested_color = lp.color;
262 if (lp.suggested_scale != 0.0) {
263 def->_suggested_scale = lp.suggested_scale;
265 if (lp.units !=
nullptr) {
266 def->_level_units = lp.units;
268 if (lp.inv_factor != 0.0) {
269 def->_factor = 1.0 / lp.inv_factor;
287 if (def->_index == 0) {
288 fullname = def->_name;
290 fullname = client->get_collector_fullname(def->_index);
294 initialize_collector_def_from_table(fullname, def);
302 string::const_iterator ni;
303 for (ni = fullname.begin(); ni != fullname.end(); ++ni) {
315 config_name += tolower(*ni);
321 (
"pstats-active-" + config_name,
true,
"", ConfigVariable::F_dynamic);
323 (
"pstats-sort-" + config_name, def->_sort,
"", ConfigVariable::F_dynamic);
325 (
"pstats-scale-" + config_name, def->_suggested_scale,
"", ConfigVariable::F_dynamic);
327 (
"pstats-units-" + config_name, def->_level_units,
"", ConfigVariable::F_dynamic);
329 (
"pstats-factor-" + config_name, 1.0,
"", ConfigVariable::F_dynamic);
331 (
"pstats-color-" + config_name, LColor::zero(),
"", ConfigVariable::F_dynamic);
333 if (pstats_active.has_value()) {
334 def->_is_active = pstats_active;
335 def->_active_explicitly_set =
true;
338 def->_sort = pstats_sort;
339 def->_suggested_scale = pstats_scale;
340 def->_level_units = pstats_units;
341 if (pstats_factor.has_value()) {
342 def->_factor = pstats_factor;
345 if (pstats_color.has_value()) {
346 def->_suggested_color.r = pstats_color[0];
347 def->_suggested_color.g = pstats_color[1];
348 def->_suggested_color.b = pstats_color[2];