From de53aa32e0af4a14f6a0d0f27817b41e7befa62e Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Wed, 21 Mar 2012 01:27:09 +0000
Subject: Add Scene.DebugUpdates switch which, if turned on, will print out a
warning when a frame updates takes longer than twice the desired time
This is controlled via "debug scene updates true|false" on the region console.
Also fix an oversight with "debug scene teleport true|false"
---
OpenSim/Region/Framework/Scenes/Scene.cs | 42 ++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 10 deletions(-)
(limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index e1e4ed5..92c1060 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -65,8 +65,17 @@ namespace OpenSim.Region.Framework.Scenes
#region Fields
public bool EmergencyMonitoring = false;
+
+ ///
+ /// Show debug information about teleports.
+ ///
public bool DebugTeleporting { get; private set; }
+ ///
+ /// Show debug information about the scene loop.
+ ///
+ public bool DebugUpdates { get; private set; }
+
public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter;
public List NorthBorders = new List();
@@ -1060,13 +1069,24 @@ namespace OpenSim.Region.Framework.Scenes
if (options.ContainsKey("physics"))
{
- bool enablePhysics = false;
- if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics)
+ bool enablePhysics;
+ if (bool.TryParse(options["physics"], out enablePhysics))
m_physics_enabled = enablePhysics;
}
if (options.ContainsKey("teleport"))
- DebugTeleporting = true;
+ {
+ bool enableTeleportDebugging;
+ if (bool.TryParse(options["teleport"], out enableTeleportDebugging))
+ DebugTeleporting = enableTeleportDebugging;
+ }
+
+ if (options.ContainsKey("updates"))
+ {
+ bool enableUpdateDebugging;
+ if (bool.TryParse(options["updates"], out enableUpdateDebugging))
+ DebugUpdates = enableUpdateDebugging;
+ }
}
public int GetInaccurateNeighborCount()
@@ -1390,7 +1410,7 @@ namespace OpenSim.Region.Framework.Scenes
// Tell the watchdog that this thread is still alive
Watchdog.UpdateThread();
-// previousFrameTick = m_lastFrameTick;
+ previousFrameTick = m_lastFrameTick;
m_lastFrameTick = Util.EnvironmentTickCount();
maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
maintc = (int)(MinFrameTime * 1000) - maintc;
@@ -1399,12 +1419,14 @@ namespace OpenSim.Region.Framework.Scenes
Thread.Sleep(maintc);
// 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}",
-// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
-// MinFrameTime * 1000,
-// RegionInfo.RegionName);
+ if (DebugUpdates
+ && Util.EnvironmentTickCountSubtract(
+ m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
+ m_log.WarnFormat(
+ "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
+ Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
+ MinFrameTime * 1000,
+ RegionInfo.RegionName);
}
}
--
cgit v1.1