From 8bb29054165b1fa3284b200ca6682eb1c81e977f Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Sun, 28 Oct 2012 11:55:11 +0000 Subject: test limit ode exec time by time not number of loops done --- OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs') diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index cce8946..5e01ff1 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs @@ -1714,9 +1714,8 @@ namespace OpenSim.Region.Physics.OdePlugin else curphysiteractions = m_physicsiterations; - int nodeframes = 0; - // checkThread(); + int nodeframes = 0; lock (SimulationLock) lock(OdeLock) @@ -1733,7 +1732,11 @@ namespace OpenSim.Region.Physics.OdePlugin d.WorldSetQuickStepNumIterations(world, curphysiteractions); - while (step_time > HalfOdeStep && nodeframes < 10) //limit number of steps so we don't say here for ever + int loopstartMS = Util.EnvironmentTickCount(); + int looptimeMS = 0; + + + while (step_time > HalfOdeStep) { try { @@ -1742,9 +1745,8 @@ namespace OpenSim.Region.Physics.OdePlugin if (ChangesQueue.Count > 0) { - int ttmpstart = Util.EnvironmentTickCount(); + int changestartMS = Util.EnvironmentTickCount(); int ttmp; - while (ChangesQueue.Dequeue(out item)) { if (item.actor != null) @@ -1762,7 +1764,7 @@ namespace OpenSim.Region.Physics.OdePlugin item.actor.Name, item.what.ToString()); } } - ttmp = Util.EnvironmentTickCountSubtract(ttmpstart); + ttmp = Util.EnvironmentTickCountSubtract(changestartMS); if (ttmp > 20) break; } @@ -1873,9 +1875,12 @@ namespace OpenSim.Region.Physics.OdePlugin // ode.dunlock(world); } - step_time -= ODE_STEPSIZE; nodeframes++; + + looptimeMS = Util.EnvironmentTickCountSubtract(loopstartMS); + if (looptimeMS > 100) + break; } lock (_badCharacter) @@ -1963,7 +1968,7 @@ namespace OpenSim.Region.Physics.OdePlugin // think time dilation as to do with dinamic step size that we dont' have // even so tell something to world - if (nodeframes < 10) // we did the requested loops + if (looptimeMS < 100) // we did the requested loops m_timeDilation = 1.0f; else if (step_time > 0) { -- cgit v1.1