Add profiling events to sfx manager, but they are commented out
by default (using preprocessor directives), since they are typically not useful.
This commit is contained in:
parent
6a0fb83209
commit
0acda38987
@ -24,6 +24,7 @@
|
||||
#include "io/file_manager.hpp"
|
||||
#include "modes/world.hpp"
|
||||
#include "race/race_manager.hpp"
|
||||
#include "utils/profiler.hpp"
|
||||
#include "utils/vs.hpp"
|
||||
|
||||
#include <pthread.h>
|
||||
@ -46,6 +47,17 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// Define this if the profiler should also collect data of the sfx manager
|
||||
#undef ENABLE_PROFILING_FOR_SFX_MANAGER
|
||||
#ifndef ENABLE_PROFILING_FOR_SFX_MANAGER
|
||||
// Otherwise ignore the profiler push/pop events
|
||||
// Use undef to remove preprocessor warning
|
||||
# undef PROFILER_PUSH_CPU_MARKER
|
||||
# undef PROFILER_POP_CPU_MARKER
|
||||
# define PROFILER_PUSH_CPU_MARKER(name, r, g, b)
|
||||
# define PROFILER_POP_CPU_MARKER()
|
||||
#endif
|
||||
|
||||
SFXManager *SFXManager::m_sfx_manager;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
@ -302,6 +314,7 @@ void* SFXManager::mainLoop(void *obj)
|
||||
while (me->m_sfx_commands.getData().empty() ||
|
||||
me->m_sfx_commands.getData().front()->m_command!=SFX_EXIT)
|
||||
{
|
||||
PROFILER_PUSH_CPU_MARKER("Wait", 255, 0, 0);
|
||||
bool empty = me->m_sfx_commands.getData().empty();
|
||||
|
||||
// Wait in cond_wait for a request to arrive. The 'while' is necessary
|
||||
@ -321,6 +334,8 @@ void* SFXManager::mainLoop(void *obj)
|
||||
break;
|
||||
}
|
||||
me->m_sfx_commands.unlock();
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
PROFILER_PUSH_CPU_MARKER("Execute", 0, 255, 0);
|
||||
switch (current->m_command)
|
||||
{
|
||||
case SFX_PLAY: current->m_sfx->reallyPlayNow(); break;
|
||||
@ -383,6 +398,8 @@ void* SFXManager::mainLoop(void *obj)
|
||||
}
|
||||
delete current;
|
||||
current = NULL;
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
PROFILER_PUSH_CPU_MARKER("yield", 0, 0, 255);
|
||||
// We access the size without lock, doesn't matter if we
|
||||
// should get an incorrect value because of concurrent read/writes
|
||||
if (me->m_sfx_commands.getData().size() == 0)
|
||||
@ -395,7 +412,7 @@ void* SFXManager::mainLoop(void *obj)
|
||||
me->queue(SFX_UPDATE, (SFXBase*)NULL, float(t));
|
||||
}
|
||||
me->m_sfx_commands.lock();
|
||||
|
||||
PROFILER_POP_CPU_MARKER();
|
||||
} // while
|
||||
|
||||
// Signal that the sfx manager can now be deleted.
|
||||
|
Loading…
Reference in New Issue
Block a user