Add "active true|false" to "debug scene" console command.

This allows the scene update and maintenance loops to be started and stopped for debug purposes.
0.7.4-extended
Justin Clark-Casey (justincc) 2012-10-12 02:52:08 +01:00
parent 39b8d01e71
commit 2b5dc4eba4
2 changed files with 47 additions and 6 deletions

View File

@ -254,8 +254,14 @@ namespace OpenSim
m_console.Commands.AddCommand("Debug", false, "debug teleport", "debug teleport", "Toggle teleport route debugging", Debug);
m_console.Commands.AddCommand("Debug", false, "debug scene",
"debug scene <scripting> <collisions> <physics>",
"Turn on scene debugging", Debug);
"debug scene active|collisions|physics|scripting|teleport true|false",
"Turn on scene debugging.",
"If active is false then main scene update and maintenance loops are suspended.\n"
+ "If collisions is false then collisions with other objects are turned off.\n"
+ "If physics is false then all physics objects are non-physical.\n"
+ "If scripting is false then no scripting operations happen.\n"
+ "If teleport is true then some extra teleport debug information is logged.",
Debug);
m_console.Commands.AddCommand("General", false, "change region",
"change region <region name>",
@ -928,7 +934,8 @@ namespace OpenSim
}
else
{
MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics|teleport true|false");
MainConsole.Instance.Output(
"Usage: debug scene active|scripting|collisions|physics|teleport true|false");
}
break;

View File

@ -281,6 +281,30 @@ namespace OpenSim.Region.Framework.Scenes
}
private volatile bool m_shuttingDown;
/// <summary>
/// Is the scene active?
/// </summary>
/// <remarks>
/// If false, maintenance and update loops are not run.
/// </remarks>
public bool Active
{
get { return m_active; }
set
{
if (value)
{
if (!m_active)
Start();
}
else
{
m_active = false;
}
}
}
private volatile bool m_active;
// private int m_lastUpdate;
// private bool m_firstHeartbeat = true;
@ -1115,6 +1139,14 @@ namespace OpenSim.Region.Framework.Scenes
public void SetSceneCoreDebug(Dictionary<string, string> options)
{
if (options.ContainsKey("active"))
{
bool active;
if (bool.TryParse(options["active"], out active))
Active = active;
}
if (options.ContainsKey("scripting"))
{
bool enableScripts = true;
@ -1254,6 +1286,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void Start()
{
m_active = true;
// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName);
//m_heartbeatTimer.Enabled = true;
@ -1295,7 +1329,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Update Methods
/// <summary>
/// Performs per-frame updates regularly
/// Activate the various loops necessary to continually update the scene.
/// </summary>
private void Heartbeat()
{
@ -1352,7 +1386,7 @@ namespace OpenSim.Region.Framework.Scenes
List<Vector3> coarseLocations;
List<UUID> avatarUUIDs;
while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun))
while (Active && !m_shuttingDown && (endRun == null || MaintenanceRun < endRun))
{
runtc = Util.EnvironmentTickCount();
++MaintenanceRun;
@ -1411,7 +1445,7 @@ namespace OpenSim.Region.Framework.Scenes
int previousFrameTick, tmpMS;
int maintc = Util.EnvironmentTickCount();
while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
while (Active && !m_shuttingDown && (endFrame == null || Frame < endFrame))
{
++Frame;