aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorMelanie2009-11-30 08:25:40 +0000
committerMelanie2009-11-30 08:25:40 +0000
commit69d83e1548b4e18bdee15f2ff558d386e68ec489 (patch)
treed7b2399a1d5bc343116671e2c436d72569899936 /OpenSim/Region/Framework/Scenes/Scene.cs
parentMerge branch 'master' into careminster (diff)
parent* Patch from Misterblue to fix Environment.TickCount for statistics purposes.... (diff)
downloadopensim-SC_OLD-69d83e1548b4e18bdee15f2ff558d386e68ec489.zip
opensim-SC_OLD-69d83e1548b4e18bdee15f2ff558d386e68ec489.tar.gz
opensim-SC_OLD-69d83e1548b4e18bdee15f2ff558d386e68ec489.tar.bz2
opensim-SC_OLD-69d83e1548b4e18bdee15f2ff558d386e68ec489.tar.xz
Merge branch 'master' into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs68
1 files changed, 32 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index c12c81b..f5a1e74 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
@@ -1101,7 +1104,7 @@ namespace OpenSim.Region.Framework.Scenes
1101 HeartbeatThread.Abort(); 1104 HeartbeatThread.Abort();
1102 HeartbeatThread = null; 1105 HeartbeatThread = null;
1103 } 1106 }
1104 m_lastUpdate = Environment.TickCount; 1107 m_lastUpdate = Util.EnvironmentTickCount();
1105 1108
1106 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false); 1109 HeartbeatThread = Watchdog.StartThread(Heartbeat, "Heartbeat for region " + RegionInfo.RegionName, ThreadPriority.Normal, false);
1107 } 1110 }
@@ -1142,7 +1145,7 @@ namespace OpenSim.Region.Framework.Scenes
1142 { 1145 {
1143 Update(); 1146 Update();
1144 1147
1145 m_lastUpdate = Environment.TickCount; 1148 m_lastUpdate = Util.EnvironmentTickCount();
1146 m_firstHeartbeat = false; 1149 m_firstHeartbeat = false;
1147 } 1150 }
1148 catch (ThreadAbortException) 1151 catch (ThreadAbortException)
@@ -1170,8 +1173,9 @@ namespace OpenSim.Region.Framework.Scenes
1170 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1173 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate;
1171 physicsFPS = 0f; 1174 physicsFPS = 0f;
1172 1175
1173 maintc = otherMS = Environment.TickCount; 1176 maintc = Util.EnvironmentTickCount();
1174 int tmpFrameMS = maintc; 1177 int tmpFrameMS = maintc;
1178 tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1175 1179
1176 // Increment the frame counter 1180 // Increment the frame counter
1177 ++m_frame; 1181 ++m_frame;
@@ -1191,16 +1195,15 @@ namespace OpenSim.Region.Framework.Scenes
1191 if (m_frame % m_update_objects == 0) 1195 if (m_frame % m_update_objects == 0)
1192 m_sceneGraph.UpdateObjectGroups(); 1196 m_sceneGraph.UpdateObjectGroups();
1193 1197
1194 int TempPhysicsMS2 = Environment.TickCount; 1198 int tmpPhysicsMS2 = Util.EnvironmentTickCount();
1195 if ((m_frame % m_update_physics == 0) && m_physics_enabled) 1199 if ((m_frame % m_update_physics == 0) && m_physics_enabled)
1196 m_sceneGraph.UpdatePreparePhysics(); 1200 m_sceneGraph.UpdatePreparePhysics();
1197 TempPhysicsMS2 = Environment.TickCount - TempPhysicsMS2; 1201 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
1198 physicsMS2 = TempPhysicsMS2;
1199 1202
1200 if (m_frame % m_update_entitymovement == 0) 1203 if (m_frame % m_update_entitymovement == 0)
1201 m_sceneGraph.UpdateScenePresenceMovement(); 1204 m_sceneGraph.UpdateScenePresenceMovement();
1202 1205
1203 int TempPhysicsMS = Environment.TickCount; 1206 int tmpPhysicsMS = Util.EnvironmentTickCount();
1204 if (m_frame % m_update_physics == 0) 1207 if (m_frame % m_update_physics == 0)
1205 { 1208 {
1206 if (m_physics_enabled) 1209 if (m_physics_enabled)
@@ -1208,57 +1211,49 @@ namespace OpenSim.Region.Framework.Scenes
1208 if (SynchronizeScene != null) 1211 if (SynchronizeScene != null)
1209 SynchronizeScene(this); 1212 SynchronizeScene(this);
1210 } 1213 }
1211 TempPhysicsMS = Environment.TickCount - TempPhysicsMS; 1214 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
1212 physicsMS = TempPhysicsMS;
1213 1215
1214 // Delete temp-on-rez stuff 1216 // Delete temp-on-rez stuff
1215 if (m_frame % m_update_backup == 0) 1217 if (m_frame % m_update_backup == 0)
1216 { 1218 {
1217 int tozMS = Environment.TickCount; 1219 int tmpTempOnRezMS = Util.EnvironmentTickCount();
1218 CleanTempObjects(); 1220 CleanTempObjects();
1219 tozMS -= Environment.TickCount; 1221 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
1220 tempOnRezMS = tozMS;
1221 } 1222 }
1222 1223
1223 if (RegionStatus != RegionStatus.SlaveScene) 1224 if (RegionStatus != RegionStatus.SlaveScene)
1224 { 1225 {
1225 if (m_frame % m_update_events == 0) 1226 if (m_frame % m_update_events == 0)
1226 { 1227 {
1227 int evMS = Environment.TickCount; 1228 int evMS = Util.EnvironmentTickCount();
1228 UpdateEvents(); 1229 UpdateEvents();
1229 evMS -= Environment.TickCount; 1230 eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
1230 eventMS = evMS;
1231 } 1231 }
1232 1232
1233 if (m_frame % m_update_backup == 0) 1233 if (m_frame % m_update_backup == 0)
1234 { 1234 {
1235 int backMS = Environment.TickCount; 1235 int backMS = Util.EnvironmentTickCount();
1236 UpdateStorageBackup(); 1236 UpdateStorageBackup();
1237 backMS -= Environment.TickCount; 1237 backupMS = Util.EnvironmentTickCountSubtract(backMS);
1238 backupMS = backMS;
1239 } 1238 }
1240 1239
1241 if (m_frame % m_update_terrain == 0) 1240 if (m_frame % m_update_terrain == 0)
1242 { 1241 {
1243 int terMS = Environment.TickCount; 1242 int terMS = Util.EnvironmentTickCount();
1244 UpdateTerrain(); 1243 UpdateTerrain();
1245 terMS -= Environment.TickCount; 1244 terrainMS = Util.EnvironmentTickCountSubtract(terMS);
1246 terrainMS = terMS;
1247 } 1245 }
1248 1246
1249 if (m_frame % m_update_land == 0) 1247 if (m_frame % m_update_land == 0)
1250 { 1248 {
1251 int ldMS = Environment.TickCount; 1249 int ldMS = Util.EnvironmentTickCount();
1252 UpdateLand(); 1250 UpdateLand();
1253 ldMS -= Environment.TickCount; 1251 landMS = Util.EnvironmentTickCountSubtract(ldMS);
1254 landMS = ldMS;
1255 } 1252 }
1256 1253
1257 int tickCount = Environment.TickCount; 1254 frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
1258 otherMS = tickCount - otherMS; 1255 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1259 tmpFrameMS -= tickCount; 1256 lastCompletedFrame = Util.EnvironmentTickCount();
1260 frameMS = tmpFrameMS;
1261 lastCompletedFrame = tickCount;
1262 1257
1263 // if (m_frame%m_update_avatars == 0) 1258 // if (m_frame%m_update_avatars == 0)
1264 // UpdateInWorldTime(); 1259 // UpdateInWorldTime();
@@ -1311,8 +1306,8 @@ namespace OpenSim.Region.Framework.Scenes
1311 { 1306 {
1312 m_lastupdate = DateTime.UtcNow; 1307 m_lastupdate = DateTime.UtcNow;
1313 } 1308 }
1314 1309
1315 maintc = Environment.TickCount - maintc; 1310 maintc = Util.EnvironmentTickCountSubtract(maintc);
1316 maintc = (int)(m_timespan * 1000) - maintc; 1311 maintc = (int)(m_timespan * 1000) - maintc;
1317 1312
1318 if ((maintc < (m_timespan * 1000)) && maintc > 0) 1313 if ((maintc < (m_timespan * 1000)) && maintc > 0)
@@ -1323,6 +1318,7 @@ namespace OpenSim.Region.Framework.Scenes
1323 } 1318 }
1324 } 1319 }
1325 1320
1321
1326 1322
1327 public void AddGroupTarget(SceneObjectGroup grp) 1323 public void AddGroupTarget(SceneObjectGroup grp)
1328 { 1324 {
@@ -2599,7 +2595,7 @@ namespace OpenSim.Region.Framework.Scenes
2599 } 2595 }
2600 } 2596 }
2601 2597
2602 m_LastLogin = Environment.TickCount; 2598 m_LastLogin = Util.EnvironmentTickCount();
2603 EventManager.TriggerOnNewClient(client); 2599 EventManager.TriggerOnNewClient(client);
2604 } 2600 }
2605 2601
@@ -4668,14 +4664,14 @@ namespace OpenSim.Region.Framework.Scenes
4668 // 4664 //
4669 int health=1; // Start at 1, means we're up 4665 int health=1; // Start at 1, means we're up
4670 4666
4671 if ((Environment.TickCount - m_lastUpdate) < 1000) 4667 if ((Util.EnvironmentTickCountSubtract(m_lastUpdate)) < 1000)
4672 health+=1; 4668 health+=1;
4673 else 4669 else
4674 return health; 4670 return health;
4675 4671
4676 // A login in the last 4 mins? We can't be doing too badly 4672 // A login in the last 4 mins? We can't be doing too badly
4677 // 4673 //
4678 if ((Environment.TickCount - m_LastLogin) < 240000) 4674 if ((Util.EnvironmentTickCountSubtract(m_LastLogin)) < 240000)
4679 health++; 4675 health++;
4680 else 4676 else
4681 return health; 4677 return health;
@@ -4873,7 +4869,7 @@ namespace OpenSim.Region.Framework.Scenes
4873 if (m_firstHeartbeat) 4869 if (m_firstHeartbeat)
4874 return; 4870 return;
4875 4871
4876 if (System.Environment.TickCount - m_lastUpdate > 2000) 4872 if (Util.EnvironmentTickCountSubtract(m_lastUpdate) > 2000)
4877 StartTimer(); 4873 StartTimer();
4878 } 4874 }
4879 } 4875 }