From 8f3255f9c8d717c02053a4839c0610b21518e6f9 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 5 Nov 2011 23:09:31 +0000 Subject: [PATCH] Fix tests and Atlas with new profiler This was SVN commit r10471. --- source/ps/GameSetup/GameSetup.cpp | 1 - source/ps/Profiler2.cpp | 2 ++ source/test_setup.cpp | 9 +++++++++ source/tools/atlas/GameInterface/GameLoop.cpp | 4 +++- 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/source/ps/GameSetup/GameSetup.cpp b/source/ps/GameSetup/GameSetup.cpp index a9175709fd..bb491391ae 100644 --- a/source/ps/GameSetup/GameSetup.cpp +++ b/source/ps/GameSetup/GameSetup.cpp @@ -781,7 +781,6 @@ void EarlyInit() // initialise profiler early so it can profile startup g_Profiler2.Initialise(); - g_Profiler2.RegisterCurrentThread("main"); FixLocales(); diff --git a/source/ps/Profiler2.cpp b/source/ps/Profiler2.cpp index a41000594f..be8d661ebf 100644 --- a/source/ps/Profiler2.cpp +++ b/source/ps/Profiler2.cpp @@ -129,6 +129,8 @@ void CProfiler2::Initialise() int err = pthread_key_create(&m_TLS, &CProfiler2::TLSDtor); ENSURE(err == 0); m_Initialised = true; + + RegisterCurrentThread("main"); } void CProfiler2::EnableHTTP() diff --git a/source/test_setup.cpp b/source/test_setup.cpp index 5a83253172..fd1be36179 100644 --- a/source/test_setup.cpp +++ b/source/test_setup.cpp @@ -35,6 +35,7 @@ #include "lib/timer.h" #include "lib/sysdep/sysdep.h" +#include "ps/Profiler2.h" #include "scriptinterface/ScriptInterface.h" class LeakReporter : public CxxTest::GlobalFixture @@ -77,9 +78,17 @@ class MiscSetup : public CxxTest::GlobalFixture setlocale(LC_CTYPE, "UTF-8"); #endif + g_Profiler2.Initialise(); + return true; } + virtual bool tearDownWorld() + { + g_Profiler2.Shutdown(); + + return true; + } }; static LeakReporter leakReporter; diff --git a/source/tools/atlas/GameInterface/GameLoop.cpp b/source/tools/atlas/GameInterface/GameLoop.cpp index 4bc3483e29..a1cda3a6d7 100644 --- a/source/tools/atlas/GameInterface/GameLoop.cpp +++ b/source/tools/atlas/GameInterface/GameLoop.cpp @@ -99,13 +99,15 @@ static void RendererIncrementalLoad() while (more && timer_Time() - startTime < maxTime); } -static void* RunEngine(void *data) +static void* RunEngine(void* data) { debug_SetThreadName("engine_thread"); // Set new main thread so that all the thread-safety checks pass ThreadUtil::SetMainThread(); + g_Profiler2.RegisterCurrentThread("atlasmain"); + const CmdLineArgs args = *reinterpret_cast(data); MessagePasserImpl* msgPasser = (MessagePasserImpl*)AtlasMessage::g_MessagePasser;