Fix frame times when updating scene on timer.

ghosts
Justin Clark-Casey (justincc) 2014-08-26 18:13:00 +01:00
parent 64f640f901
commit 42bb122232
1 changed files with 17 additions and 15 deletions

View File

@ -1426,6 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes
Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true);
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
m_lastFrameTick = Util.EnvironmentTickCount();
if (UpdateOnTimer) if (UpdateOnTimer)
{ {
@ -1532,7 +1533,6 @@ namespace OpenSim.Region.Framework.Scenes
float physicsFPS = 0f; float physicsFPS = 0f;
int previousFrameTick, tmpMS; int previousFrameTick, tmpMS;
int maintc = Util.EnvironmentTickCount();
while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
{ {
@ -1672,27 +1672,29 @@ namespace OpenSim.Region.Framework.Scenes
} }
EventManager.TriggerRegionHeartbeatEnd(this); EventManager.TriggerRegionHeartbeatEnd(this);
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
if (!UpdateOnTimer) if (!UpdateOnTimer)
{
Watchdog.UpdateThread(); Watchdog.UpdateThread();
previousFrameTick = m_lastFrameTick; tmpMS = Util.EnvironmentTickCountSubtract(Util.EnvironmentTickCount(), m_lastFrameTick);
m_lastFrameTick = Util.EnvironmentTickCount();
tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
tmpMS = (int)(MinFrameTime * 1000) - tmpMS; tmpMS = (int)(MinFrameTime * 1000) - tmpMS;
if (tmpMS > 0) if (tmpMS > 0)
{ {
spareMS = tmpMS; spareMS = tmpMS;
if (!UpdateOnTimer)
Thread.Sleep(tmpMS); Thread.Sleep(tmpMS);
} }
}
else
{
spareMS = Math.Max(0, (int)(MinFrameTime * 1000) - physicsMS2 - agentMS - physicsMS -otherMS);
}
frameMS = Util.EnvironmentTickCountSubtract(maintc); previousFrameTick = m_lastFrameTick;
maintc = Util.EnvironmentTickCount(); frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick);
m_lastFrameTick = Util.EnvironmentTickCount();
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
// if (Frame%m_update_avatars == 0) // if (Frame%m_update_avatars == 0)
// UpdateInWorldTime(); // UpdateInWorldTime();