Added markers for World::update() and made the profiler optional

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9225 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
funto66 2011-07-10 10:33:42 +00:00
parent 6b0e202d2b
commit 93ed8113d3
3 changed files with 28 additions and 7 deletions

View File

@ -1232,11 +1232,13 @@ void IrrDriver::update(float dt)
Kart *kart=world->getKart(i);
if(kart->getCamera())
{
#ifdef ENABLE_PROFILER
{
std::ostringstream oss;
oss << "drawAll() for kart " << i << std::flush;
PROFILER_PUSH_CPU_MARKER(oss.str().c_str(), (i+1)*60, 0x00, 0x00);
}
#endif
kart->getCamera()->activate();
m_scene_manager->drawAll();
@ -1292,7 +1294,9 @@ void IrrDriver::update(float dt)
// Render the profiler
if(UserConfigParams::m_profiler_enabled)
profiler.draw();
{
PROFILER_DRAW();
}
} // just to mark the begin/end scene block

View File

@ -53,6 +53,7 @@
#include "tracks/track.hpp"
#include "tracks/track_manager.hpp"
#include "utils/constants.hpp"
#include "utils/profiler.hpp"
#include "utils/translation.hpp"
#include "utils/string_utils.hpp"
@ -580,6 +581,8 @@ void World::updateWorld(float dt)
*/
void World::update(float dt)
{
PROFILER_PUSH_CPU_MARKER("World::update()", 0x00, 0x7F, 0x00);
#if MEASURE_FPS
static float time = 0.0f;
time += dt;
@ -610,6 +613,8 @@ void World::update(float dt)
}
projectile_manager->update(dt);
PROFILER_POP_CPU_MARKER();
} // update
// ----------------------------------------------------------------------------

View File

@ -27,14 +27,26 @@
class Profiler;
extern Profiler profiler;
#define PROFILER_PUSH_CPU_MARKER(name, r, g, b) \
profiler.pushCpuMarker(name, video::SColor(0xFF, r, g, b))
#define ENABLE_PROFILER
#define PROFILER_POP_CPU_MARKER() \
profiler.popCpuMarker()
#ifdef ENABLE_PROFILER
#define PROFILER_PUSH_CPU_MARKER(name, r, g, b) \
profiler.pushCpuMarker(name, video::SColor(0xFF, r, g, b))
#define PROFILER_SYNC_FRAME() \
profiler.synchronizeFrame()
#define PROFILER_POP_CPU_MARKER() \
profiler.popCpuMarker()
#define PROFILER_SYNC_FRAME() \
profiler.synchronizeFrame()
#define PROFILER_DRAW() \
profiler.draw()
#else
#define PROFILER_PUSH_CPU_MARKER(name, r, g, b)
#define PROFILER_POP_CPU_MARKER()
#define PROFILER_SYNC_FRAME()
#define PROFILER_DRAW()
#endif
using namespace irr;