diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 60 |
1 files changed, 25 insertions, 35 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 8b0431c..78ccb55 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -257,7 +257,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
257 | // Central Update Loop | 257 | // Central Update Loop |
258 | 258 | ||
259 | protected int m_fps = 10; | 259 | protected int m_fps = 10; |
260 | protected int m_frame; | 260 | protected uint m_frame; |
261 | protected float m_timespan = 0.089f; | 261 | protected float m_timespan = 0.089f; |
262 | protected DateTime m_lastupdate = DateTime.UtcNow; | 262 | protected DateTime m_lastupdate = DateTime.UtcNow; |
263 | 263 | ||
@@ -1018,36 +1018,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
1018 | /// </summary> | 1018 | /// </summary> |
1019 | public override void Update() | 1019 | public override void Update() |
1020 | { | 1020 | { |
1021 | int maintc = 0; | 1021 | float physicsFPS; |
1022 | int maintc; | ||
1023 | |||
1022 | while (!shuttingdown) | 1024 | while (!shuttingdown) |
1023 | { | 1025 | { |
1024 | //#if DEBUG | ||
1025 | // int w = 0, io = 0; | ||
1026 | // ThreadPool.GetAvailableThreads(out w, out io); | ||
1027 | // if ((w < 10) || (io < 10)) | ||
1028 | // m_log.DebugFormat("[WARNING]: ThreadPool reaching exhaustion. workers = {0}; io = {1}", w, io); | ||
1029 | //#endif | ||
1030 | maintc = Environment.TickCount; | ||
1031 | |||
1032 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; | 1026 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; |
1033 | float physicsFPS = 0; | 1027 | physicsFPS = 0f; |
1034 | 1028 | ||
1035 | frameMS = Environment.TickCount; | 1029 | maintc = maintc = frameMS = otherMS = Environment.TickCount; |
1030 | |||
1031 | // Increment the frame counter | ||
1032 | ++m_frame; | ||
1036 | 1033 | ||
1037 | try | 1034 | try |
1038 | { | 1035 | { |
1039 | // Increment the frame counter | ||
1040 | m_frame++; | ||
1041 | |||
1042 | // Loop it | ||
1043 | if (m_frame == Int32.MaxValue) | ||
1044 | m_frame = 0; | ||
1045 | |||
1046 | otherMS = Environment.TickCount; | ||
1047 | |||
1048 | // Check if any objects have reached their targets | 1036 | // Check if any objects have reached their targets |
1049 | CheckAtTargets(); | 1037 | CheckAtTargets(); |
1050 | 1038 | ||
1051 | // Update SceneObjectGroups that have scheduled themselves for updates | 1039 | // Update SceneObjectGroups that have scheduled themselves for updates |
1052 | // Objects queue their updates onto all scene presences | 1040 | // Objects queue their updates onto all scene presences |
1053 | if (m_frame % m_update_objects == 0) | 1041 | if (m_frame % m_update_objects == 0) |
@@ -1067,13 +1055,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
1067 | m_sceneGraph.UpdateScenePresenceMovement(); | 1055 | m_sceneGraph.UpdateScenePresenceMovement(); |
1068 | 1056 | ||
1069 | physicsMS = Environment.TickCount; | 1057 | physicsMS = Environment.TickCount; |
1070 | if ((m_frame % m_update_physics == 0) && m_physics_enabled) | 1058 | if (m_frame % m_update_physics == 0) |
1071 | physicsFPS = m_sceneGraph.UpdatePhysics( | 1059 | { |
1072 | Math.Max(SinceLastFrame.TotalSeconds, m_timespan) | 1060 | if (m_physics_enabled) |
1073 | ); | 1061 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); |
1074 | if (m_frame % m_update_physics == 0 && SynchronizeScene != null) | 1062 | if (SynchronizeScene != null) |
1075 | SynchronizeScene(this); | 1063 | SynchronizeScene(this); |
1076 | 1064 | } | |
1077 | physicsMS = Environment.TickCount - physicsMS; | 1065 | physicsMS = Environment.TickCount - physicsMS; |
1078 | physicsMS += physicsMS2; | 1066 | physicsMS += physicsMS2; |
1079 | 1067 | ||
@@ -1095,25 +1083,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1095 | if (m_frame % m_update_land == 0) | 1083 | if (m_frame % m_update_land == 0) |
1096 | UpdateLand(); | 1084 | UpdateLand(); |
1097 | 1085 | ||
1098 | otherMS = Environment.TickCount - otherMS; | 1086 | int tickCount = Environment.TickCount; |
1087 | otherMS = tickCount - otherMS; | ||
1088 | frameMS = tickCount - frameMS; | ||
1089 | |||
1099 | // if (m_frame%m_update_avatars == 0) | 1090 | // if (m_frame%m_update_avatars == 0) |
1100 | // UpdateInWorldTime(); | 1091 | // UpdateInWorldTime(); |
1101 | StatsReporter.AddPhysicsFPS(physicsFPS); | 1092 | StatsReporter.AddPhysicsFPS(physicsFPS); |
1102 | StatsReporter.AddTimeDilation(TimeDilation); | 1093 | StatsReporter.AddTimeDilation(TimeDilation); |
1103 | StatsReporter.AddFPS(1); | 1094 | StatsReporter.AddFPS(1); |
1104 | StatsReporter.AddInPackets(0); | ||
1105 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); | 1095 | StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); |
1106 | StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); | 1096 | StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); |
1107 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | 1097 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); |
1108 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | 1098 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); |
1109 | frameMS = Environment.TickCount - frameMS; | ||
1110 | StatsReporter.addFrameMS(frameMS); | 1099 | StatsReporter.addFrameMS(frameMS); |
1111 | StatsReporter.addPhysicsMS(physicsMS); | 1100 | StatsReporter.addPhysicsMS(physicsMS); |
1112 | StatsReporter.addOtherMS(otherMS); | 1101 | StatsReporter.addOtherMS(otherMS); |
1113 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | 1102 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); |
1114 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | 1103 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); |
1115 | } | 1104 | } |
1116 | if (loginsdisabled && (m_frame > 20)) | 1105 | |
1106 | if (loginsdisabled && m_frame > 20) | ||
1117 | { | 1107 | { |
1118 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, | 1108 | // In 99.9% of cases it is a bad idea to manually force garbage collection. However, |
1119 | // this is a rare case where we know we have just went through a long cycle of heap | 1109 | // this is a rare case where we know we have just went through a long cycle of heap |
@@ -1176,9 +1166,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
1176 | { | 1166 | { |
1177 | lock (m_groupsWithTargets) | 1167 | lock (m_groupsWithTargets) |
1178 | { | 1168 | { |
1179 | foreach (KeyValuePair<UUID, SceneObjectGroup> kvp in m_groupsWithTargets) | 1169 | foreach (SceneObjectGroup entry in m_groupsWithTargets.Values) |
1180 | { | 1170 | { |
1181 | kvp.Value.checkAtTargets(); | 1171 | entry.checkAtTargets(); |
1182 | } | 1172 | } |
1183 | } | 1173 | } |
1184 | } | 1174 | } |