Example impl:
while !(quitGame)
{
{
PROFILE(SID("Poll Joypad"));
PollJoypad();
}
{
PROFILE(SID("Game Object Update"));
UpdateGameObjects();
}
{
PROFILE(SID("Physics"));
Physics();
}
...
}
struct AutoProfile
{
AutoProfile(const char *name)
{
m_name = name;
m_startTime = getTime();
}
~AutoProfile()
{
m_stopTime = getTime();
m_totalTime = m_stopTime - m_startTime;
g_profileManager.storeSample(m_name, m_totalTime);
}
}