test limit ode exec time by time not number of loops done

avinationmerge
UbitUmarov 2012-10-28 11:55:11 +00:00
parent ad7f273d95
commit 8bb2905416
1 changed files with 13 additions and 8 deletions

View File

@ -1714,9 +1714,8 @@ namespace OpenSim.Region.Physics.OdePlugin
else else
curphysiteractions = m_physicsiterations; curphysiteractions = m_physicsiterations;
int nodeframes = 0;
// checkThread(); // checkThread();
int nodeframes = 0;
lock (SimulationLock) lock (SimulationLock)
lock(OdeLock) lock(OdeLock)
@ -1733,7 +1732,11 @@ namespace OpenSim.Region.Physics.OdePlugin
d.WorldSetQuickStepNumIterations(world, curphysiteractions); 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 try
{ {
@ -1742,9 +1745,8 @@ namespace OpenSim.Region.Physics.OdePlugin
if (ChangesQueue.Count > 0) if (ChangesQueue.Count > 0)
{ {
int ttmpstart = Util.EnvironmentTickCount(); int changestartMS = Util.EnvironmentTickCount();
int ttmp; int ttmp;
while (ChangesQueue.Dequeue(out item)) while (ChangesQueue.Dequeue(out item))
{ {
if (item.actor != null) if (item.actor != null)
@ -1762,7 +1764,7 @@ namespace OpenSim.Region.Physics.OdePlugin
item.actor.Name, item.what.ToString()); item.actor.Name, item.what.ToString());
} }
} }
ttmp = Util.EnvironmentTickCountSubtract(ttmpstart); ttmp = Util.EnvironmentTickCountSubtract(changestartMS);
if (ttmp > 20) if (ttmp > 20)
break; break;
} }
@ -1873,9 +1875,12 @@ namespace OpenSim.Region.Physics.OdePlugin
// ode.dunlock(world); // ode.dunlock(world);
} }
step_time -= ODE_STEPSIZE; step_time -= ODE_STEPSIZE;
nodeframes++; nodeframes++;
looptimeMS = Util.EnvironmentTickCountSubtract(loopstartMS);
if (looptimeMS > 100)
break;
} }
lock (_badCharacter) 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 // think time dilation as to do with dinamic step size that we dont' have
// even so tell something to world // 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; m_timeDilation = 1.0f;
else if (step_time > 0) else if (step_time > 0)
{ {