Added timing output for physics loop when using --physics-debug.

This commit is contained in:
hiker 2018-10-20 00:39:03 +11:00
parent 8bb75803ab
commit 964d7bf8de

View File

@ -21,6 +21,7 @@
#include "animations/three_d_animation.hpp"
#include "config/player_manager.hpp"
#include "config/player_profile.hpp"
#include "config/user_config.hpp"
#include "karts/abstract_kart.hpp"
#include "graphics/irr_driver.hpp"
#include "graphics/stars.hpp"
@ -164,8 +165,17 @@ void Physics::update(int ticks)
// Since the world update (which calls physics update) is called at the
// fixed frequency necessary for the physics update, we need to do exactly
// one physic step only.
double start;
if(UserConfigParams::m_physics_debug) start = StkTime::getRealTime();
m_dynamics_world->stepSimulation(stk_config->ticks2Time(1), 1,
stk_config->ticks2Time(1) );
if (UserConfigParams::m_physics_debug)
{
Log::verbose("Physics", "At %d physics duration %12.8f",
World::getWorld()->getTicksSinceStart(),
StkTime::getRealTime() - start);
}
// Now handle the actual collision. Note: flyables can not be removed
// inside of this loop, since the same flyables might hit more than one