aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDan Lake2011-10-30 23:39:39 -0700
committerDan Lake2011-10-30 23:39:39 -0700
commita85ff884d97c3ea56200a5070f66bc523b7c4ca3 (patch)
tree99eade06b967bee44dccfb484d738f281d4e9e4c
parentAdd missing max_listens_per_region to [LL_Functions] config section in OpenSi... (diff)
downloadopensim-SC_OLD-a85ff884d97c3ea56200a5070f66bc523b7c4ca3.zip
opensim-SC_OLD-a85ff884d97c3ea56200a5070f66bc523b7c4ca3.tar.gz
opensim-SC_OLD-a85ff884d97c3ea56200a5070f66bc523b7c4ca3.tar.bz2
opensim-SC_OLD-a85ff884d97c3ea56200a5070f66bc523b7c4ca3.tar.xz
Experimental reorder of Heartbeat loop now simulates physics and sends updates to clients prior to sleep. Existing behavior was to sleep BEFORE sending updates. We found this patch reduced latency to clients by 1-2 heartbeat periods.
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs56
1 files changed, 27 insertions, 29 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index ff05e95..fa8bf85 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1230,8 +1230,32 @@ namespace OpenSim.Region.Framework.Scenes
1230// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame); 1230// m_log.DebugFormat("[SCENE]: Processing frame {0}", Frame);
1231 1231
1232 try 1232 try
1233 { 1233 {
1234 int tmpAgentMS = Util.EnvironmentTickCount(); 1234 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1235 if ((Frame % m_update_physics == 0) && m_physics_enabled)
1236 m_sceneGraph.UpdatePreparePhysics();
1237 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1238
1239 // Apply any pending avatar force input to the avatar's velocity
1240 int tmpAgentMS = Util.EnvironmentTickCount();
1241 if (Frame % m_update_entitymovement == 0)
1242 m_sceneGraph.UpdateScenePresenceMovement();
1243 agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS);
1244
1245 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1246 // velocity
1247 int tmpPhysicsMS = Util.EnvironmentTickCount();
1248 if (Frame % m_update_physics == 0)
1249 {
1250 if (m_physics_enabled)
1251 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1252
1253 if (SynchronizeScene != null)
1254 SynchronizeScene(this);
1255 }
1256 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1257
1258 tmpAgentMS = Util.EnvironmentTickCount();
1235 1259
1236 // Check if any objects have reached their targets 1260 // Check if any objects have reached their targets
1237 CheckAtTargets(); 1261 CheckAtTargets();
@@ -1259,33 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes
1259 }); 1283 });
1260 } 1284 }
1261 1285
1262 agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); 1286 agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS);
1263
1264 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1265 if ((Frame % m_update_physics == 0) && m_physics_enabled)
1266 m_sceneGraph.UpdatePreparePhysics();
1267 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1268
1269 // Apply any pending avatar force input to the avatar's velocity
1270 if (Frame % m_update_entitymovement == 0)
1271 {
1272 tmpAgentMS = Util.EnvironmentTickCount();
1273 m_sceneGraph.UpdateScenePresenceMovement();
1274 agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS);
1275 }
1276
1277 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1278 // velocity
1279 int tmpPhysicsMS = Util.EnvironmentTickCount();
1280 if (Frame % m_update_physics == 0)
1281 {
1282 if (m_physics_enabled)
1283 physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
1284
1285 if (SynchronizeScene != null)
1286 SynchronizeScene(this);
1287 }
1288 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1289 1287
1290 // Delete temp-on-rez stuff 1288 // Delete temp-on-rez stuff
1291 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1289 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)