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"
0.7.3-extended
Justin Clark-Casey (justincc) 2012-03-21 01:27:09 +00:00
parent df55fd69af
commit fa952f6d35
1 changed files with 32 additions and 10 deletions

View File

@ -65,8 +65,17 @@ namespace OpenSim.Region.Framework.Scenes
#region Fields #region Fields
public bool EmergencyMonitoring = false; public bool EmergencyMonitoring = false;
/// <summary>
/// Show debug information about teleports.
/// </summary>
public bool DebugTeleporting { get; private set; } public bool DebugTeleporting { get; private set; }
/// <summary>
/// Show debug information about the scene loop.
/// </summary>
public bool DebugUpdates { get; private set; }
public SynchronizeSceneHandler SynchronizeScene; public SynchronizeSceneHandler SynchronizeScene;
public SimStatsReporter StatsReporter; public SimStatsReporter StatsReporter;
public List<Border> NorthBorders = new List<Border>(); public List<Border> NorthBorders = new List<Border>();
@ -1070,13 +1079,24 @@ namespace OpenSim.Region.Framework.Scenes
if (options.ContainsKey("physics")) if (options.ContainsKey("physics"))
{ {
bool enablePhysics = false; bool enablePhysics;
if (bool.TryParse(options["physics"], out enablePhysics) && m_physics_enabled != enablePhysics) if (bool.TryParse(options["physics"], out enablePhysics))
m_physics_enabled = enablePhysics; m_physics_enabled = enablePhysics;
} }
if (options.ContainsKey("teleport")) 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() public int GetInaccurateNeighborCount()
@ -1398,7 +1418,7 @@ namespace OpenSim.Region.Framework.Scenes
// Tell the watchdog that this thread is still alive // Tell the watchdog that this thread is still alive
Watchdog.UpdateThread(); Watchdog.UpdateThread();
// previousFrameTick = m_lastFrameTick; previousFrameTick = m_lastFrameTick;
m_lastFrameTick = Util.EnvironmentTickCount(); m_lastFrameTick = Util.EnvironmentTickCount();
maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
maintc = (int)(MinFrameTime * 1000) - maintc; maintc = (int)(MinFrameTime * 1000) - maintc;
@ -1407,12 +1427,14 @@ namespace OpenSim.Region.Framework.Scenes
Thread.Sleep(maintc); Thread.Sleep(maintc);
// Optionally warn if a frame takes double the amount of time that it should. // Optionally warn if a frame takes double the amount of time that it should.
// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) if (DebugUpdates
// m_log.WarnFormat( && Util.EnvironmentTickCountSubtract(
// "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))
// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), m_log.WarnFormat(
// MinFrameTime * 1000, "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}",
// RegionInfo.RegionName); Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick),
MinFrameTime * 1000,
RegionInfo.RegionName);
} }
} }