Fix tests and Atlas with new profiler

This was SVN commit r10471.
This commit is contained in:
Ykkrosh 2011-11-05 23:09:31 +00:00
parent b13f1cade5
commit 8f3255f9c8
4 changed files with 14 additions and 2 deletions

View File

@ -781,7 +781,6 @@ void EarlyInit()
// initialise profiler early so it can profile startup
g_Profiler2.Initialise();
g_Profiler2.RegisterCurrentThread("main");
FixLocales();

View File

@ -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()

View File

@ -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;

View File

@ -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<const CmdLineArgs*>(data);
MessagePasserImpl* msgPasser = (MessagePasserImpl*)AtlasMessage::g_MessagePasser;