Skip to content

Commit e0397e4

Browse files
feat(profiling): Add messages to Tracy profiling on game start and game end (TheSuperHackers#2202)
1 parent 579a8b1 commit e0397e4

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,14 @@ void GameLogic::startNewGame( Bool loadingSaveGame )
11711171

11721172
m_rankLevelLimit = 1000; // this is reset every game.
11731173

1174+
#ifdef TRACY_ENABLE
1175+
{
1176+
char msg[512];
1177+
snprintf(msg, sizeof(msg), "GameStart: %s", TheGlobalData->m_mapName.str());
1178+
TracyMessage(msg, strlen(msg));
1179+
}
1180+
#endif
1181+
11741182
//
11751183
// only reset the next object ID allocater counter when we're not loading a save game.
11761184
// for save games, we read this value out of the save game file and it is important

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "GameClient/GUICallbacks.h"
7979
#include "GameClient/InGameUI.h"
8080
#include "GameClient/KeyDefs.h"
81+
8182
#include "GameClient/Mouse.h"
8283
#include "GameClient/ParticleSys.h"
8384
#include "GameClient/Shell.h"
@@ -86,6 +87,7 @@
8687

8788
#include "GameNetwork/NetworkInterface.h"
8889

90+
#include <rts/profile.h>
8991

9092

9193

@@ -251,6 +253,19 @@ void GameLogic::clearGameData( Bool showScoreScreen )
251253

252254
setClearingGameData( TRUE );
253255

256+
#ifdef TRACY_ENABLE
257+
{
258+
char msg[512];
259+
int len = snprintf(msg, sizeof(msg), "GameEnd: %s", TheGlobalData->m_mapName.str());
260+
if (len > 0)
261+
{
262+
if (len > (int)sizeof(msg) - 1)
263+
len = (int)sizeof(msg) - 1;
264+
TracyMessage(msg, (size_t)len);
265+
}
266+
}
267+
#endif
268+
254269
// m_background = TheWindowManager->winCreateLayout("Menus/BlankWindow.wnd");
255270
// DEBUG_ASSERTCRASH(m_background,("We Couldn't Load Menus/BlankWindow.wnd"));
256271
// m_background->hide(FALSE);

0 commit comments

Comments
 (0)