From e9271ec653f4c09d73f7950c3e4b1615c445478f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 19 Mar 2012 22:48:26 +0000
Subject: Add some doc about the EventManager.OnLoginsEnabled event.
---
OpenSim/Region/Framework/Scenes/EventManager.cs | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/EventManager.cs b/OpenSim/Region/Framework/Scenes/EventManager.cs
index 6ff2a6f..1e1fcb7 100644
--- a/OpenSim/Region/Framework/Scenes/EventManager.cs
+++ b/OpenSim/Region/Framework/Scenes/EventManager.cs
@@ -481,6 +481,13 @@ namespace OpenSim.Region.Framework.Scenes
public event RegionHeartbeatEnd OnRegionHeartbeatEnd;
public delegate void LoginsEnabled(string regionName);
+
+ ///
+ /// This should only fire in all circumstances if the RegionReady module is active.
+ ///
+ ///
+ /// TODO: Fire this even when the RegionReady module is not active.
+ ///
public event LoginsEnabled OnLoginsEnabled;
public delegate void PrimsLoaded(Scene s);
--
cgit v1.1
From 8c911ddaf051724af8684bf18559e8e33e0fcfb1 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Mar 2012 01:39:19 +0000
Subject: Remove some pointless catching/throwing in the scene loop.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 7 -------
1 file changed, 7 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0706905..18a7ce8 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1184,9 +1184,6 @@ namespace OpenSim.Region.Framework.Scenes
m_lastUpdate = Util.EnvironmentTickCount();
m_firstHeartbeat = false;
}
- catch (ThreadAbortException)
- {
- }
finally
{
Monitor.Pulse(m_heartbeatLock);
@@ -1357,10 +1354,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
}
- catch (NotImplementedException)
- {
- throw;
- }
catch (Exception e)
{
m_log.ErrorFormat(
--
cgit v1.1
From a3abd65e3de850a4516b91a017b1049ce4abe4fe Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Mar 2012 01:41:32 +0000
Subject: Remove pointless ThreadAbortException catching in a test that isn't
run anyway.
---
.../Framework/Scenes/Tests/ScenePresenceTeleportTests.cs | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
index c5a76b2..bebc10c 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceTeleportTests.cs
@@ -63,17 +63,11 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Thread testThread = new Thread(testClass.run);
- try
- {
- // Seems kind of redundant to start a thread and then join it, however.. We need to protect against
- // A thread abort exception in the simulator code.
- testThread.Start();
- testThread.Join();
- }
- catch (ThreadAbortException)
- {
-
- }
+ // Seems kind of redundant to start a thread and then join it, however.. We need to protect against
+ // A thread abort exception in the simulator code.
+ testThread.Start();
+ testThread.Join();
+
Assert.That(testClass.results.Result, Is.EqualTo(true), testClass.results.Message);
// Console.WriteLine("Beginning test {0}", MethodBase.GetCurrentMethod());
}
--
cgit v1.1
From 9ed3532c1b4fdbf8283e86ba7fb6f2706a5cfb97 Mon Sep 17 00:00:00 2001
From: nebadon
Date: Tue, 20 Mar 2012 13:45:38 -0700
Subject: reduce avatar verticle jump from the absurd 5 meter jump to a less
absurd 3m vertical jump to better match what you would see in Second Life and
be more in line with what users would expect.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index b84660a..82f6486 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2293,7 +2293,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (direc.Z > 2.0f)
{
- direc.Z *= 3.0f;
+ direc.Z *= 2.5f;
// TODO: PreJump and jump happen too quickly. Many times prejump gets ignored.
Animator.TrySetMovementAnimation("PREJUMP");
--
cgit v1.1
From bd1f848bf6194f15301fb9bcdae095dd3a67d594 Mon Sep 17 00:00:00 2001
From: nebadon
Date: Tue, 20 Mar 2012 14:17:15 -0700
Subject: slight increase in jump power to make running jump slightly better.
---
OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 82f6486..704d12d 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -2293,7 +2293,7 @@ namespace OpenSim.Region.Framework.Scenes
{
if (direc.Z > 2.0f)
{
- direc.Z *= 2.5f;
+ direc.Z *= 2.6f;
// TODO: PreJump and jump happen too quickly. Many times prejump gets ignored.
Animator.TrySetMovementAnimation("PREJUMP");
--
cgit v1.1
From 30b2a8c778d02926e038bc62977c4a4c9dbec5ee Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Mar 2012 23:12:21 +0000
Subject: Move frame loop entirely within Scene.Update() for better future
performance analysis and stat accuracy.
Update() now accepts a frames parameter which can control the number of frames updated.
-1 will update until shutdown.
The watchdog updating moves above the maintc recalculation for any required sleep since it should be accounted for within the frame.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 337 +++++++++++----------
OpenSim/Region/Framework/Scenes/SceneBase.cs | 8 +-
.../Scenes/Tests/ScenePresenceAutopilotTests.cs | 12 +-
.../Region/Framework/Scenes/Tests/SceneTests.cs | 2 +-
4 files changed, 191 insertions(+), 168 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 18a7ce8..fe59e4d 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1175,11 +1175,11 @@ namespace OpenSim.Region.Framework.Scenes
// The first frame can take a very long time due to physics actors being added on startup. Therefore,
// don't turn on the watchdog alarm for this thread until the second frame, in order to prevent false
// alarms for scenes with many objects.
- Update();
+ Update(1);
Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
while (!shuttingdown)
- Update();
+ Update(-1);
m_lastUpdate = Util.EnvironmentTickCount();
m_firstHeartbeat = false;
@@ -1193,184 +1193,205 @@ namespace OpenSim.Region.Framework.Scenes
Watchdog.RemoveThread();
}
- public override void Update()
+ public override void Update(int frames)
{
- float physicsFPS = 0f;
-
- int maintc = Util.EnvironmentTickCount();
- int tmpFrameMS = maintc;
- agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
+ long? endFrame = null;
- ++Frame;
+ if (frames >= 0)
+ endFrame = Frame + frames;
-// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
+ float physicsFPS = 0f;
+ int tmpFrameMS, tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS;
+ int maintc;
+ List coarseLocations;
+ List avatarUUIDs;
- try
+ while (!shuttingdown && (endFrame == null || Frame < endFrame))
{
- int tmpPhysicsMS2 = Util.EnvironmentTickCount();
- if ((Frame % m_update_physics == 0) && m_physics_enabled)
- m_sceneGraph.UpdatePreparePhysics();
- physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
-
- // Apply any pending avatar force input to the avatar's velocity
- int tmpAgentMS = Util.EnvironmentTickCount();
- if (Frame % m_update_entitymovement == 0)
- m_sceneGraph.UpdateScenePresenceMovement();
- agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS);
-
- // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
- // velocity
- int tmpPhysicsMS = Util.EnvironmentTickCount();
- if (Frame % m_update_physics == 0)
- {
- if (m_physics_enabled)
- physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
+ maintc = Util.EnvironmentTickCount();
+ ++Frame;
- if (SynchronizeScene != null)
- SynchronizeScene(this);
- }
- physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
-
- tmpAgentMS = Util.EnvironmentTickCount();
-
- // Check if any objects have reached their targets
- CheckAtTargets();
-
- // Update SceneObjectGroups that have scheduled themselves for updates
- // Objects queue their updates onto all scene presences
- if (Frame % m_update_objects == 0)
- m_sceneGraph.UpdateObjectGroups();
+// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
- // Run through all ScenePresences looking for updates
- // Presence updates and queued object updates for each presence are sent to clients
- if (Frame % m_update_presences == 0)
- m_sceneGraph.UpdatePresences();
+ tmpFrameMS = maintc;
+ agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
- // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
- if (Frame % m_update_coarse_locations == 0)
+ try
{
- List coarseLocations;
- List avatarUUIDs;
- SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
- // Send coarse locations to clients
- ForEachScenePresence(delegate(ScenePresence presence)
+ tmpPhysicsMS2 = Util.EnvironmentTickCount();
+ if ((Frame % m_update_physics == 0) && m_physics_enabled)
+ m_sceneGraph.UpdatePreparePhysics();
+ physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2);
+
+ // Apply any pending avatar force input to the avatar's velocity
+ tmpAgentMS = Util.EnvironmentTickCount();
+ if (Frame % m_update_entitymovement == 0)
+ m_sceneGraph.UpdateScenePresenceMovement();
+ agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS);
+
+ // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
+ // velocity
+ tmpPhysicsMS = Util.EnvironmentTickCount();
+ if (Frame % m_update_physics == 0)
{
- presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
- });
- }
-
- agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS);
-
- // Delete temp-on-rez stuff
- if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
- {
- int tmpTempOnRezMS = Util.EnvironmentTickCount();
- m_cleaningTemps = true;
- Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
- tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
- }
-
- if (Frame % m_update_events == 0)
- {
- int evMS = Util.EnvironmentTickCount();
- UpdateEvents();
- eventMS = Util.EnvironmentTickCountSubtract(evMS); ;
- }
-
- if (Frame % m_update_backup == 0)
- {
- int backMS = Util.EnvironmentTickCount();
- UpdateStorageBackup();
- backupMS = Util.EnvironmentTickCountSubtract(backMS);
- }
-
- if (Frame % m_update_terrain == 0)
- {
- int terMS = Util.EnvironmentTickCount();
- UpdateTerrain();
- terrainMS = Util.EnvironmentTickCountSubtract(terMS);
- }
-
- //if (Frame % m_update_land == 0)
- //{
- // int ldMS = Util.EnvironmentTickCount();
- // UpdateLand();
- // landMS = Util.EnvironmentTickCountSubtract(ldMS);
- //}
-
- frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
- otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
- lastCompletedFrame = Util.EnvironmentTickCount();
-
- // if (Frame%m_update_avatars == 0)
- // UpdateInWorldTime();
- StatsReporter.AddPhysicsFPS(physicsFPS);
- StatsReporter.AddTimeDilation(TimeDilation);
- StatsReporter.AddFPS(1);
- StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
- StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
- StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
- StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
- StatsReporter.addFrameMS(frameMS);
- StatsReporter.addAgentMS(agentMS);
- StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
- StatsReporter.addOtherMS(otherMS);
- StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
- StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
-
- if (LoginsDisabled && Frame == 20)
- {
-// m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
-
- // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
- // this is a rare case where we know we have just went through a long cycle of heap
- // allocations, and there is no more work to be done until someone logs in
- GC.Collect();
+ if (m_physics_enabled)
+ physicsFPS = m_sceneGraph.UpdatePhysics(MinFrameTime);
+
+ if (SynchronizeScene != null)
+ SynchronizeScene(this);
+ }
+ physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS);
- IConfig startupConfig = m_config.Configs["Startup"];
- if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
+ tmpAgentMS = Util.EnvironmentTickCount();
+
+ // Check if any objects have reached their targets
+ CheckAtTargets();
+
+ // Update SceneObjectGroups that have scheduled themselves for updates
+ // Objects queue their updates onto all scene presences
+ if (Frame % m_update_objects == 0)
+ m_sceneGraph.UpdateObjectGroups();
+
+ // Run through all ScenePresences looking for updates
+ // Presence updates and queued object updates for each presence are sent to clients
+ if (Frame % m_update_presences == 0)
+ m_sceneGraph.UpdatePresences();
+
+ // Coarse locations relate to positions of green dots on the mini-map (on a SecondLife client)
+ if (Frame % m_update_coarse_locations == 0)
+ {
+ SceneGraph.GetCoarseLocations(out coarseLocations, out avatarUUIDs, 60);
+ // Send coarse locations to clients
+ ForEachScenePresence(delegate(ScenePresence presence)
+ {
+ presence.SendCoarseLocations(coarseLocations, avatarUUIDs);
+ });
+ }
+
+ agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS);
+
+ // Delete temp-on-rez stuff
+ if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
+ {
+ tmpTempOnRezMS = Util.EnvironmentTickCount();
+ m_cleaningTemps = true;
+ Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
+ tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS);
+ }
+
+ if (Frame % m_update_events == 0)
{
- // This handles a case of a region having no scripts for the RegionReady module
- if (m_sceneGraph.GetActiveScriptsCount() == 0)
+ evMS = Util.EnvironmentTickCount();
+ UpdateEvents();
+ eventMS = Util.EnvironmentTickCountSubtract(evMS);
+ }
+
+ if (Frame % m_update_backup == 0)
+ {
+ backMS = Util.EnvironmentTickCount();
+ UpdateStorageBackup();
+ backupMS = Util.EnvironmentTickCountSubtract(backMS);
+ }
+
+ if (Frame % m_update_terrain == 0)
+ {
+ terMS = Util.EnvironmentTickCount();
+ UpdateTerrain();
+ terrainMS = Util.EnvironmentTickCountSubtract(terMS);
+ }
+
+ //if (Frame % m_update_land == 0)
+ //{
+ // int ldMS = Util.EnvironmentTickCount();
+ // UpdateLand();
+ // landMS = Util.EnvironmentTickCountSubtract(ldMS);
+ //}
+
+ frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
+ otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
+ lastCompletedFrame = Util.EnvironmentTickCount();
+
+ // if (Frame%m_update_avatars == 0)
+ // UpdateInWorldTime();
+ StatsReporter.AddPhysicsFPS(physicsFPS);
+ StatsReporter.AddTimeDilation(TimeDilation);
+ StatsReporter.AddFPS(1);
+ StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
+ StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
+ StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
+ StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
+
+ // frameMS currently records work frame times, not total frame times (work + any required sleep to
+ // reach min frame time.
+ StatsReporter.addFrameMS(frameMS);
+
+ StatsReporter.addAgentMS(agentMS);
+ StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
+ StatsReporter.addOtherMS(otherMS);
+ StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
+ StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
+
+ if (LoginsDisabled && Frame == 20)
+ {
+ // m_log.DebugFormat("{0} {1} {2}", LoginsDisabled, m_sceneGraph.GetActiveScriptsCount(), LoginLock);
+
+ // In 99.9% of cases it is a bad idea to manually force garbage collection. However,
+ // this is a rare case where we know we have just went through a long cycle of heap
+ // allocations, and there is no more work to be done until someone logs in
+ GC.Collect();
+
+ IConfig startupConfig = m_config.Configs["Startup"];
+ if (startupConfig == null || !startupConfig.GetBoolean("StartDisabled", false))
{
- // need to be able to tell these have changed in RegionReady
- LoginLock = false;
- EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
+ // This handles a case of a region having no scripts for the RegionReady module
+ if (m_sceneGraph.GetActiveScriptsCount() == 0)
+ {
+ // need to be able to tell these have changed in RegionReady
+ LoginLock = false;
+ EventManager.TriggerLoginsEnabled(RegionInfo.RegionName);
+ }
+ m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
+
+ // For RegionReady lockouts
+ if(LoginLock == false)
+ {
+ LoginsDisabled = false;
+ }
+
+ m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo);
}
- m_log.DebugFormat("[REGION]: Enabling logins for {0}", RegionInfo.RegionName);
-
- // For RegionReady lockouts
- if(LoginLock == false)
+ else
{
- LoginsDisabled = false;
+ StartDisabled = true;
+ LoginsDisabled = true;
}
-
- m_sceneGridService.InformNeighborsThatRegionisUp(RequestModuleInterface(), RegionInfo);
- }
- else
- {
- StartDisabled = true;
- LoginsDisabled = true;
}
}
- }
- catch (Exception e)
- {
- m_log.ErrorFormat(
- "[SCENE]: Failed on region {0} with exception {1}{2}",
- RegionInfo.RegionName, e.Message, e.StackTrace);
- }
+ catch (Exception e)
+ {
+ m_log.ErrorFormat(
+ "[SCENE]: Failed on region {0} with exception {1}{2}",
+ RegionInfo.RegionName, e.Message, e.StackTrace);
+ }
+
+ EventManager.TriggerRegionHeartbeatEnd(this);
- EventManager.TriggerRegionHeartbeatEnd(this);
+ // Tell the watchdog that this thread is still alive
+ Watchdog.UpdateThread();
- maintc = Util.EnvironmentTickCountSubtract(maintc);
- maintc = (int)(MinFrameTime * 1000) - maintc;
+ maintc = Util.EnvironmentTickCountSubtract(maintc);
+ maintc = (int)(MinFrameTime * 1000) - maintc;
- if (maintc > 0)
- Thread.Sleep(maintc);
+ if (maintc > 0)
+ Thread.Sleep(maintc);
- // Tell the watchdog that this thread is still alive
- Watchdog.UpdateThread();
+// if (frameMS > (int)(MinFrameTime * 1000))
+// m_log.WarnFormat(
+// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
+// frameMS,
+// MinFrameTime * 1000,
+// RegionInfo.RegionName);
+ }
}
public void AddGroupTarget(SceneObjectGroup grp)
diff --git a/OpenSim/Region/Framework/Scenes/SceneBase.cs b/OpenSim/Region/Framework/Scenes/SceneBase.cs
index 495cede..9c6b884 100644
--- a/OpenSim/Region/Framework/Scenes/SceneBase.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneBase.cs
@@ -149,9 +149,13 @@ namespace OpenSim.Region.Framework.Scenes
#region Update Methods
///
- /// Normally called once every frame/tick to let the world preform anything required (like running the physics simulation)
+ /// Called to update the scene loop by a number of frames and until shutdown.
///
- public abstract void Update();
+ ///
+ /// Number of frames to update. Exits on shutdown even if there are frames remaining.
+ /// If -1 then updates until shutdown.
+ ///
+ public abstract void Update(int frames);
#endregion
diff --git a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
index 442cb8b..cfea10d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/ScenePresenceAutopilotTests.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
// For now, we'll make the scene presence fly to simplify this test, but this needs to change.
sp.Flying = true;
- m_scene.Update();
+ m_scene.Update(1);
Assert.That(sp.AbsolutePosition, Is.EqualTo(startPos));
Vector3 targetPos = startPos + new Vector3(0, 10, 0);
@@ -91,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(
sp.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0.7071068f, 0.7071068f), 0.000001));
- m_scene.Update();
+ m_scene.Update(1);
// We should really check the exact figure.
Assert.That(sp.AbsolutePosition.X, Is.EqualTo(startPos.X));
@@ -99,8 +99,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
Assert.That(sp.AbsolutePosition.Z, Is.LessThan(targetPos.X));
- for (int i = 0; i < 10; i++)
- m_scene.Update();
+ m_scene.Update(10);
double distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos);
Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on first move");
@@ -116,7 +115,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(
sp.Rotation, new QuaternionToleranceConstraint(new Quaternion(0, 0, 0, 1), 0.000001));
- m_scene.Update();
+ m_scene.Update(1);
// We should really check the exact figure.
Assert.That(sp.AbsolutePosition.X, Is.GreaterThan(startPos.X));
@@ -124,8 +123,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
Assert.That(sp.AbsolutePosition.Y, Is.EqualTo(startPos.Y));
Assert.That(sp.AbsolutePosition.Z, Is.EqualTo(startPos.Z));
- for (int i = 0; i < 10; i++)
- m_scene.Update();
+ m_scene.Update(10);
distanceToTarget = Util.GetDistanceTo(sp.AbsolutePosition, targetPos);
Assert.That(distanceToTarget, Is.LessThan(1), "Avatar not within 1 unit of target position on second move");
diff --git a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
index 8b8aea5..5c9a77d 100644
--- a/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
+++ b/OpenSim/Region/Framework/Scenes/Tests/SceneTests.cs
@@ -61,7 +61,7 @@ namespace OpenSim.Region.Framework.Scenes.Tests
TestHelpers.InMethod();
Scene scene = SceneHelpers.SetupScene();
- scene.Update();
+ scene.Update(1);
Assert.That(scene.Frame, Is.EqualTo(1));
}
--
cgit v1.1
From 3701f893d366643529429851cfac462951655683 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 20 Mar 2012 23:31:57 +0000
Subject: remove unnecessary tmpFrameMS, use maintc instead for frame time
calculation
---
OpenSim/Region/Framework/Scenes/Scene.cs | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index fe59e4d..1bea14f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1201,7 +1201,7 @@ namespace OpenSim.Region.Framework.Scenes
endFrame = Frame + frames;
float physicsFPS = 0f;
- int tmpFrameMS, tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS;
+ int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS;
int maintc;
List coarseLocations;
List avatarUUIDs;
@@ -1213,7 +1213,6 @@ namespace OpenSim.Region.Framework.Scenes
// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
- tmpFrameMS = maintc;
agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
try
@@ -1307,7 +1306,7 @@ namespace OpenSim.Region.Framework.Scenes
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
//}
- frameMS = Util.EnvironmentTickCountSubtract(tmpFrameMS);
+ frameMS = Util.EnvironmentTickCountSubtract(maintc);
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
lastCompletedFrame = Util.EnvironmentTickCount();
--
cgit v1.1
From 7bf628ab31028ac2118e43fbb9b9d0a77ea0f55f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 21 Mar 2012 00:02:08 +0000
Subject: Add ability to log warn if a frame takes longer than twice the
expected time. Currently commented out.
---
OpenSim/Region/Framework/Scenes/Scene.cs | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1bea14f..790ec63 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -190,7 +190,11 @@ namespace OpenSim.Region.Framework.Scenes
private int backupMS;
private int terrainMS;
private int landMS;
- private int lastCompletedFrame;
+
+ ///
+ /// Tick at which the last frame was processed.
+ ///
+ private int m_lastFrameTick;
///
/// Signals whether temporary objects are currently being cleaned up. Needed because this is launched
@@ -464,7 +468,7 @@ namespace OpenSim.Region.Framework.Scenes
public int MonitorBackupTime { get { return backupMS; } }
public int MonitorTerrainTime { get { return terrainMS; } }
public int MonitorLandTime { get { return landMS; } }
- public int MonitorLastFrameTick { get { return lastCompletedFrame; } }
+ public int MonitorLastFrameTick { get { return m_lastFrameTick; } }
public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } }
public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } }
@@ -1202,6 +1206,7 @@ namespace OpenSim.Region.Framework.Scenes
float physicsFPS = 0f;
int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS;
+ int previousFrameTick;
int maintc;
List coarseLocations;
List avatarUUIDs;
@@ -1305,10 +1310,9 @@ namespace OpenSim.Region.Framework.Scenes
// UpdateLand();
// landMS = Util.EnvironmentTickCountSubtract(ldMS);
//}
-
+
frameMS = Util.EnvironmentTickCountSubtract(maintc);
otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
- lastCompletedFrame = Util.EnvironmentTickCount();
// if (Frame%m_update_avatars == 0)
// UpdateInWorldTime();
@@ -1378,16 +1382,19 @@ namespace OpenSim.Region.Framework.Scenes
// Tell the watchdog that this thread is still alive
Watchdog.UpdateThread();
- maintc = Util.EnvironmentTickCountSubtract(maintc);
+// previousFrameTick = m_lastFrameTick;
+ m_lastFrameTick = Util.EnvironmentTickCount();
+ maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
maintc = (int)(MinFrameTime * 1000) - maintc;
if (maintc > 0)
Thread.Sleep(maintc);
-// if (frameMS > (int)(MinFrameTime * 1000))
+ // Optionally warn if a frame takes double the amount of time that it should.
+// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
// m_log.WarnFormat(
// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
-// frameMS,
+// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
// MinFrameTime * 1000,
// RegionInfo.RegionName);
}
--
cgit v1.1