aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-11-29 05:06:25 -0500
committerTeravus Ovares (Dan Olivares)2009-11-29 05:06:25 -0500
commit4338f4e1d7c841ba447eb2d7481daaa009182bc7 (patch)
tree12a3822843fbd40beb1cd7149203bd20e4db79c1 /OpenSim/Region/Framework/Scenes/Scene.cs
parentAdd some conditionals to references to the WorldComm module, so that the (diff)
downloadopensim-SC-4338f4e1d7c841ba447eb2d7481daaa009182bc7.zip
opensim-SC-4338f4e1d7c841ba447eb2d7481daaa009182bc7.tar.gz
opensim-SC-4338f4e1d7c841ba447eb2d7481daaa009182bc7.tar.bz2
opensim-SC-4338f4e1d7c841ba447eb2d7481daaa009182bc7.tar.xz
* Patch from Misterblue to fix Environment.TickCount for statistics purposes. Resolves the wrap-around of the 32 bit uint.
* Teravus moved the Environment methods to the Util class
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs118
1 files changed, 57 insertions, 61 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fbabb5c..a3f3d8f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -310,7 +310,7 @@ namespace OpenSim.Region.Framework.Scenes
310 private Thread HeartbeatThread; 310 private Thread HeartbeatThread;
311 private volatile bool shuttingdown; 311 private volatile bool shuttingdown;
312 312
313 private int m_lastUpdate = Environment.TickCount; 313 private int m_lastUpdate;
314 private bool m_firstHeartbeat = true; 314 private bool m_firstHeartbeat = true;
315 315
316 private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time; 316 private UpdatePrioritizationSchemes m_update_prioritization_scheme = UpdatePrioritizationSchemes.Time;
@@ -526,6 +526,7 @@ namespace OpenSim.Region.Framework.Scenes
526 m_regionHandle = m_regInfo.RegionHandle; 526 m_regionHandle = m_regInfo.RegionHandle;
527 m_regionName = m_regInfo.RegionName; 527 m_regionName = m_regInfo.RegionName;
528 m_datastore = m_regInfo.DataStore; 528 m_datastore = m_regInfo.DataStore;
529 m_lastUpdate = Util.EnvironmentTickCount();
529 530
530 m_physicalPrim = physicalPrim; 531 m_physicalPrim = physicalPrim;
531 m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor; 532 m_seeIntoRegionFromNeighbor = SeeIntoRegionFromNeighbor;
@@ -735,6 +736,8 @@ namespace OpenSim.Region.Framework.Scenes
735 736
736 m_regInfo = regInfo; 737 m_regInfo = regInfo;
737 m_eventManager = new EventManager(); 738 m_eventManager = new EventManager();
739
740 m_lastUpdate = Util.EnvironmentTickCount();
738 } 741 }
739 742
740 #endregion 743 #endregion
@@ -1089,7 +1092,7 @@ namespace OpenSim.Region.Framework.Scenes
1089 HeartbeatThread.Abort(); 1092 HeartbeatThread.Abort();
1090 HeartbeatThread = null; 1093 HeartbeatThread = null;
1091 } 1094 }
1092 m_lastUpdate = Environment.TickCount; 1095 m_lastUpdate = Util.EnvironmentTickCount();
1093 1096
1094 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false); 1097 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
1095 } 1098 }
@@ -1130,7 +1133,7 @@ namespace OpenSim.Region.Framework.Scenes
1130 { 1133 {
1131 Update(); 1134 Update();
1132 1135
1133 m_lastUpdate = Environment.TickCount; 1136 m_lastUpdate = Util.EnvironmentTickCount();
1134 m_firstHeartbeat = false; 1137 m_firstHeartbeat = false;
1135 } 1138 }
1136 catch (ThreadAbortException) 1139 catch (ThreadAbortException)
@@ -1156,10 +1159,11 @@ namespace OpenSim.Region.Framework.Scenes
1156 while (!shuttingdown) 1159 while (!shuttingdown)
1157 { 1160 {
1158 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1161 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
1159 physicsFPS = 0f; 1162 physicsFPS = 0f;
1160 1163
1161 maintc = otherMS = Environment.TickCount; 1164 maintc = Util.EnvironmentTickCount();
1162 int tmpFrameMS = maintc; 1165 int tmpFrameMS = maintc;
1166 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1163 1167
1164 // Increment the frame counter 1168 // Increment the frame counter
1165 ++m_frame; 1169 ++m_frame;
@@ -1179,74 +1183,65 @@ namespace OpenSim.Region.Framework.Scenes
1179 if (m_frame % m_update_presences == 0) 1183 if (m_frame % m_update_presences == 0)
1180 m_sceneGraph.UpdatePresences(); 1184 m_sceneGraph.UpdatePresences();
1181 1185
1182 int TempPhysicsMS2 = Environment.TickCount; 1186 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1183 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 1187 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
1184 m_sceneGraph.UpdatePreparePhysics(); 1188 m_sceneGraph.UpdatePreparePhysics();
1185 TempPhysicsMS2 = Environment.TickCount - TempPhysicsMS2; 1189 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1186 physicsMS2 = TempPhysicsMS2;
1187 1190
1188 if (m_frame % m_update_entitymovement == 0) 1191 if (m_frame % m_update_entitymovement == 0)
1189 m_sceneGraph.UpdateScenePresenceMovement(); 1192 m_sceneGraph.UpdateScenePresenceMovement();
1190 1193
1191 int TempPhysicsMS = Environment.TickCount; 1194 int tmpPhysicsMS = Util.EnvironmentTickCount();
1192 if (m_frame % m_update_physics == 0) 1195 if (m_frame % m_update_physics == 0)
1193 { 1196 {
1194 if (m_physics_enabled) 1197 if (m_physics_enabled)
1195 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); 1198 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan));
1196 if (SynchronizeScene != null) 1199 if (SynchronizeScene != null)
1197 SynchronizeScene(this); 1200 SynchronizeScene(this);
1198 } 1201 }
1199 TempPhysicsMS = Environment.TickCount - TempPhysicsMS; 1202 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1200 physicsMS = TempPhysicsMS;
1201 1203
1202 // Delete temp-on-rez stuff 1204 // Delete temp-on-rez stuff
1203 if (m_frame % m_update_backup == 0) 1205 if (m_frame % m_update_backup == 0)
1204 { 1206 {
1205 int tozMS = Environment.TickCount; 1207 int tmpTempOnRezMS = Util.EnvironmentTickCount();
1206 CleanTempObjects(); 1208 CleanTempObjects();
1207 tozMS -= Environment.TickCount; 1209 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1208 tempOnRezMS = tozMS;
1209 } 1210 }
1210 1211
1211 if (RegionStatus != RegionStatus.SlaveScene) 1212 if (RegionStatus != RegionStatus.SlaveScene)
1212 { 1213 {
1213 if (m_frame % m_update_events == 0) 1214 if (m_frame % m_update_events == 0)
1214 { 1215 {
1215 int evMS = Environment.TickCount; 1216 int evMS = Util.EnvironmentTickCount();
1216 UpdateEvents(); 1217 UpdateEvents();
1217 evMS -= Environment.TickCount; 1218 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1218 eventMS = evMS;
1219 } 1219 }
1220 1220
1221 if (m_frame % m_update_backup == 0) 1221 if (m_frame % m_update_backup == 0)
1222 { 1222 {
1223 int backMS = Environment.TickCount; 1223 int backMS = Util.EnvironmentTickCount();
1224 UpdateStorageBackup(); 1224 UpdateStorageBackup();
1225 backMS -= Environment.TickCount; 1225 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1226 backupMS = backMS;
1227 } 1226 }
1228 1227
1229 if (m_frame % m_update_terrain == 0) 1228 if (m_frame % m_update_terrain == 0)
1230 { 1229 {
1231 int terMS = Environment.TickCount; 1230 int terMS = Util.EnvironmentTickCount();
1232 UpdateTerrain(); 1231 UpdateTerrain();
1233 terMS -= Environment.TickCount; 1232 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1234 terrainMS = terMS;
1235 } 1233 }
1236 1234
1237 if (m_frame % m_update_land == 0) 1235 if (m_frame % m_update_land == 0)
1238 { 1236 {
1239 int ldMS = Environment.TickCount; 1237 int ldMS = Util.EnvironmentTickCount();
1240 UpdateLand(); 1238 UpdateLand();
1241 ldMS -= Environment.TickCount; 1239 landMS = Util.EnvironmentTickCountSubtract(ldMS);
1242 landMS = ldMS; 1240 }
1243 } 1241
1244 1242 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1245 int tickCount = Environment.TickCount; 1243 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1246 otherMS = tickCount - otherMS; 1244 lastCompletedFrame = Util.EnvironmentTickCount();
1247 tmpFrameMS -= tickCount;
1248 frameMS = tmpFrameMS;
1249 lastCompletedFrame = tickCount;
1250 1245
1251 // if (m_frame%m_update_avatars == 0) 1246 // if (m_frame%m_update_avatars == 0)
1252 // UpdateInWorldTime(); 1247 // UpdateInWorldTime();
@@ -1298,9 +1293,9 @@ namespace OpenSim.Region.Framework.Scenes
1298 finally 1293 finally
1299 { 1294 {
1300 m_lastupdate = DateTime.UtcNow; 1295 m_lastupdate = DateTime.UtcNow;
1301 } 1296 }
1302 1297
1303 maintc = Environment.TickCount - maintc; 1298 maintc = Util.EnvironmentTickCountSubtract(maintc);
1304 maintc = (int)(m_timespan * 1000) - maintc; 1299 maintc = (int)(m_timespan * 1000) - maintc;
1305 1300
1306 if ((maintc < (m_timespan * 1000)) && maintc > 0) 1301 if ((maintc < (m_timespan * 1000)) && maintc > 0)
@@ -1311,6 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
1311 } 1306 }
1312 } 1307 }
1313 1308
1309
1314 1310
1315 public void AddGroupTarget(SceneObjectGroup grp) 1311 public void AddGroupTarget(SceneObjectGroup grp)
1316 { 1312 {
@@ -2585,9 +2581,9 @@ namespace OpenSim.Region.Framework.Scenes
2585 sp.IsChildAgent = false; 2581 sp.IsChildAgent = false;
2586 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); }); 2582 Util.FireAndForget(delegate(object o) { sp.RezAttachments(); });
2587 } 2583 }
2588 } 2584 }
2589 2585
2590 m_LastLogin = Environment.TickCount; 2586 m_LastLogin = Util.EnvironmentTickCount();
2591 EventManager.TriggerOnNewClient(client); 2587 EventManager.TriggerOnNewClient(client);
2592 } 2588 }
2593 2589
@@ -4654,16 +4650,16 @@ namespace OpenSim.Region.Framework.Scenes
4654 // 3 = We have seen a new user enter within the past 4 minutes 4650 // 3 = We have seen a new user enter within the past 4 minutes
4655 // which can be seen as positive confirmation of sim health 4651 // which can be seen as positive confirmation of sim health
4656 // 4652 //
4657 int health=1; // Start at 1, means we're up 4653 int health=1; // Start at 1, means we're up
4658 4654
4659 if ((Environment.TickCount - m_lastUpdate) < 1000) 4655 if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
4660 health+=1; 4656 health+=1;
4661 else 4657 else
4662 return health; 4658 return health;
4663 4659
4664 // A login in the last 4 mins? We can't be doing too badly 4660 // A login in the last 4 mins? We can't be doing too badly
4665 // 4661 //
4666 if ((Environment.TickCount - m_LastLogin) < 240000) 4662 if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000)
4667 health++; 4663 health++;
4668 else 4664 else
4669 return health; 4665 return health;
@@ -4859,9 +4855,9 @@ namespace OpenSim.Region.Framework.Scenes
4859 private void CheckHeartbeat() 4855 private void CheckHeartbeat()
4860 { 4856 {
4861 if (m_firstHeartbeat) 4857 if (m_firstHeartbeat)
4862 return; 4858 return;
4863 4859
4864 if (System.Environment.TickCount - m_lastUpdate > 2000) 4860 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
4865 StartTimer(); 4861 StartTimer();
4866 } 4862 }
4867 } 4863 }