Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/source/ps/Profile.h
Show First 20 Lines • Show All 173 Lines • ▼ Show 20 Lines | |||||
class CProfileSample | class CProfileSample | ||||
{ | { | ||||
public: | public: | ||||
CProfileSample(const char* name) | CProfileSample(const char* name) | ||||
{ | { | ||||
if (CProfileManager::IsInitialised()) | if (CProfileManager::IsInitialised()) | ||||
{ | { | ||||
// The profiler is only safe to use on the main thread | // The profiler is only safe to use on the main thread | ||||
ENSURE(ThreadUtil::IsMainThread()); | |||||
if(ThreadUtil::IsMainThread()) | |||||
g_Profiler.Start(name); | g_Profiler.Start(name); | ||||
} | } | ||||
} | } | ||||
~CProfileSample() | ~CProfileSample() | ||||
{ | { | ||||
if (CProfileManager::IsInitialised()) | if (CProfileManager::IsInitialised()) | ||||
if(ThreadUtil::IsMainThread()) | |||||
g_Profiler.Stop(); | g_Profiler.Stop(); | ||||
} | } | ||||
}; | }; | ||||
class CProfileSampleScript | class CProfileSampleScript | ||||
{ | { | ||||
public: | public: | ||||
CProfileSampleScript( const char* name ) | CProfileSampleScript( const char* name ) | ||||
{ | { | ||||
Show All 33 Lines |
Wildfire Games · Phabricator