| 230 | } |
| 231 | |
| 232 | void frameEnd() |
| 233 | { |
| 234 | s_frameTime = TFE_System::convertFromTicksToSeconds(TFE_System::getCurrentTimeInTicks() - s_frameBegin); |
| 235 | const size_t zoneCount = s_zoneList.size(); |
| 236 | const f64 expBlend = 0.99; |
| 237 | |
| 238 | // Sort Zones |
| 239 | s_sortedZoneList.clear(); |
| 240 | const size_t rootCount = s_roots.size(); |
| 241 | for (size_t r = 0; r < rootCount; r++) |
| 242 | { |
| 243 | traverseZoneTree(s_roots[r]); |
| 244 | } |
| 245 | |
| 246 | // First compute delta times for each zone. |
| 247 | for (size_t i = 0; i < zoneCount; i++) |
| 248 | { |
| 249 | s_zoneList[i].timeInZoneAve = expBlend * s_zoneList[i].timeInZoneAve + (1.0 - expBlend)*s_zoneList[i].timeInZone[s_writeBuffer]; |
| 250 | } |
| 251 | |
| 252 | // Then handle percentage of parent and clear |
| 253 | for (size_t i = 0; i < zoneCount; i++) |
| 254 | { |
| 255 | f64 parentTime = (s_zoneList[i].parent != NULL_ZONE) ? s_zoneList[s_zoneList[i].parent].timeInZone[s_writeBuffer] : s_frameTime; |
| 256 | s_zoneList[i].fractOfParentAve = expBlend * s_zoneList[i].fractOfParentAve + (1.0 - expBlend)*s_zoneList[i].timeInZone[s_writeBuffer] / parentTime; |
| 257 | // Handle the rare case the parentTime = 0 causing s_zoneList[i].fractOfParentAve to become NAN. Once that happens it will never fix itself |
| 258 | // because we are doing an average. So fix it manually. |
| 259 | if (isnan(s_zoneList[i].fractOfParentAve)) |
| 260 | { |
| 261 | s_zoneList[i].fractOfParentAve = 0.0; |
| 262 | } |
| 263 | |
| 264 | s_zoneList[i].child = NULL_ZONE; |
| 265 | s_zoneList[i].sibling = NULL_ZONE; |
| 266 | } |
| 267 | |
| 268 | s_currentFrame++; |
| 269 | } |
| 270 | |
| 271 | u32 getZoneCount() |
| 272 | { |
nothing calls this directly
no test coverage detected