Skip to content

Commit 860c892

Browse files
feat(profiling): Add plots for logical frame number and pathfinding cells/paths to Tracy profiling (TheSuperHackers#2202)
1 parent 393f850 commit 860c892

2 files changed

Lines changed: 7 additions & 5 deletions

File tree

GeneralsMD/Code/GameEngine/Source/GameLogic/AI/AIPathfind.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5798,9 +5798,7 @@ void Pathfinder::processPathfindQueue(void)
57985798
m_logicalExtent = bounds;
57995799

58005800
m_cumulativeCellsAllocated = 0; // Number of pathfind cells examined.
5801-
#ifdef DEBUG_QPF
58025801
Int pathsFound = 0;
5803-
#endif
58045802
while (m_cumulativeCellsAllocated < PATHFIND_CELLS_PER_FRAME &&
58055803
m_queuePRTail!=m_queuePRHead) {
58065804
Object *obj = TheGameLogic->findObjectByID(m_queuedPathfindRequests[m_queuePRHead]);
@@ -5809,18 +5807,20 @@ void Pathfinder::processPathfindQueue(void)
58095807
AIUpdateInterface *ai = obj->getAIUpdateInterface();
58105808
if (ai) {
58115809
ai->doPathfind(this);
5812-
#ifdef DEBUG_QPF
58135810
pathsFound++;
5814-
#endif
58155811
}
58165812
}
58175813
m_queuePRHead = m_queuePRHead+1;
58185814
if (m_queuePRHead >= PATHFIND_QUEUE_LEN) {
58195815
m_queuePRHead = 0;
58205816
}
58215817
}
5822-
if (pathsFound>0) {
5818+
if (pathsFound > 0) {
5819+
TracyPlot("PathfindCells", (double)m_cumulativeCellsAllocated);
5820+
TracyPlot("PathfindPaths", (double)pathsFound);
5821+
}
58235822
#ifdef DEBUG_QPF
5823+
if (pathsFound>0) {
58245824
#ifdef DEBUG_LOGGING
58255825
QueryPerformanceCounter((LARGE_INTEGER *)&endTime64);
58265826
timeToUpdate = ((double)(endTime64-startTime64) / (double)(freq64));

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

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

3659+
TracyPlot("LogicFrame", static_cast<int64_t>(now));
3660+
36593661
// update (execute) scripts
36603662
{
36613663
ZoneScopedN("GameLogic::ScriptEngine");

0 commit comments

Comments
 (0)