diff options
author | Justin Clark-Casey (justincc) | 2014-08-26 18:13:00 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2014-08-26 18:13:38 +0100 |
commit | 42bb122232e1c170dd89ec45fbb19256ef09aa9e (patch) | |
tree | 7c4c621700886cbead70167ac5d7fb8fa8f37fc2 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Implement experimental non-default mechanism to update scene via a timer rath... (diff) | |
download | opensim-SC_OLD-42bb122232e1c170dd89ec45fbb19256ef09aa9e.zip opensim-SC_OLD-42bb122232e1c170dd89ec45fbb19256ef09aa9e.tar.gz opensim-SC_OLD-42bb122232e1c170dd89ec45fbb19256ef09aa9e.tar.bz2 opensim-SC_OLD-42bb122232e1c170dd89ec45fbb19256ef09aa9e.tar.xz |
Fix frame times when updating scene on timer.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 53001e9..de89cc2 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1426,6 +1426,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1426 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); | 1426 | Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true); |
1427 | 1427 | ||
1428 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; | 1428 | Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; |
1429 | m_lastFrameTick = Util.EnvironmentTickCount(); | ||
1429 | 1430 | ||
1430 | if (UpdateOnTimer) | 1431 | if (UpdateOnTimer) |
1431 | { | 1432 | { |
@@ -1532,7 +1533,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
1532 | 1533 | ||
1533 | float physicsFPS = 0f; | 1534 | float physicsFPS = 0f; |
1534 | int previousFrameTick, tmpMS; | 1535 | int previousFrameTick, tmpMS; |
1535 | int maintc = Util.EnvironmentTickCount(); | ||
1536 | 1536 | ||
1537 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1537 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1538 | { | 1538 | { |
@@ -1672,27 +1672,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1672 | } | 1672 | } |
1673 | 1673 | ||
1674 | EventManager.TriggerRegionHeartbeatEnd(this); | 1674 | EventManager.TriggerRegionHeartbeatEnd(this); |
1675 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | ||
1675 | 1676 | ||
1676 | if (!UpdateOnTimer) | 1677 | if (!UpdateOnTimer) |
1678 | { | ||
1677 | Watchdog.UpdateThread(); | 1679 | Watchdog.UpdateThread(); |
1678 | 1680 | ||
1679 | previousFrameTick = m_lastFrameTick; | 1681 | tmpMS = Util.EnvironmentTickCountSubtract(Util.EnvironmentTickCount(), m_lastFrameTick); |
1680 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1682 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; |
1681 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | ||
1682 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | ||
1683 | 1683 | ||
1684 | if (tmpMS > 0) | 1684 | if (tmpMS > 0) |
1685 | { | 1685 | { |
1686 | spareMS = tmpMS; | 1686 | spareMS = tmpMS; |
1687 | |||
1688 | if (!UpdateOnTimer) | ||
1689 | Thread.Sleep(tmpMS); | 1687 | Thread.Sleep(tmpMS); |
1690 | } | 1688 | } |
1691 | 1689 | } | |
1692 | frameMS = Util.EnvironmentTickCountSubtract(maintc); | 1690 | else |
1693 | maintc = Util.EnvironmentTickCount(); | 1691 | { |
1692 | spareMS = Math.Max(0, (int)(MinFrameTime * 1000) - physicsMS2 - agentMS - physicsMS -otherMS); | ||
1693 | } | ||
1694 | 1694 | ||
1695 | otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; | 1695 | previousFrameTick = m_lastFrameTick; |
1696 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); | ||
1697 | m_lastFrameTick = Util.EnvironmentTickCount(); | ||
1696 | 1698 | ||
1697 | // if (Frame%m_update_avatars == 0) | 1699 | // if (Frame%m_update_avatars == 0) |
1698 | // UpdateInWorldTime(); | 1700 | // UpdateInWorldTime(); |