Skip to content

Commit 8082f0f

Browse files
stephanmeestersxezon
authored andcommitted
feat(profiling): Add plots for logical frame number and pathfinding cells/paths to Tracy profiling (TheSuperHackers#2202)
1 parent efbf189 commit 8082f0f

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

Core/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6072,9 +6072,7 @@ void Pathfinder::processPathfindQueue()
60726072
m_logicalExtent = bounds;
60736073

60746074
m_cumulativeCellsAllocated = 0; // Number of pathfind cells examined.
6075-
#ifdef DEBUG_QPF
60766075
Int pathsFound = 0;
6077-
#endif
60786076
while (m_cumulativeCellsAllocated < PATHFIND_CELLS_PER_FRAME &&
60796077
m_queuePRTail!=m_queuePRHead) {
60806078
Object *obj = TheGameLogic->findObjectByID(m_queuedPathfindRequests[m_queuePRHead]);
@@ -6083,16 +6081,18 @@ void Pathfinder::processPathfindQueue()
60836081
AIUpdateInterface *ai = obj->getAIUpdateInterface();
60846082
if (ai) {
60856083
ai->doPathfind(this);
6086-
#ifdef DEBUG_QPF
60876084
pathsFound++;
6088-
#endif
60896085
}
60906086
}
60916087
m_queuePRHead = m_queuePRHead+1;
60926088
if (m_queuePRHead >= PATHFIND_QUEUE_LEN) {
60936089
m_queuePRHead = 0;
60946090
}
60956091
}
6092+
if (pathsFound > 0) {
6093+
PROFILER_PLOT("PathfindCells", (double)m_cumulativeCellsAllocated);
6094+
PROFILER_PLOT("PathfindPaths", (double)pathsFound);
6095+
}
60966096
#ifdef DEBUG_QPF
60976097
if (pathsFound>0) {
60986098
#ifdef DEBUG_LOGGING

Generals/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3160,6 +3160,8 @@ void GameLogic::update()
31603160
UnsignedInt now = getFrame();
31613161
TheGameClient->setFrame(now);
31623162

3163+
PROFILER_PLOT("LogicFrame", static_cast<int64_t>(now));
3164+
31633165
// update (execute) scripts
31643166
{
31653167
TheScriptEngine->UPDATE();

GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3696,6 +3696,8 @@ void GameLogic::update()
36963696
UnsignedInt now = getFrame();
36973697
TheGameClient->setFrame(now);
36983698

3699+
PROFILER_PLOT("LogicFrame", static_cast<int64_t>(now));
3700+
36993701
// update (execute) scripts
37003702
{
37013703
TheScriptEngine->UPDATE();

0 commit comments

Comments
 (0)