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.
connector_plugin
Justin Clark-Casey (justincc) 2012-10-12 02:52:08 +01:00
parent b7e75d467c
commit b5a3c74a5c
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 teleport", "debug teleport", "Toggle teleport route debugging", Debug);
m_console.Commands.AddCommand("Debug", false, "debug scene", m_console.Commands.AddCommand("Debug", false, "debug scene",
"debug scene <scripting> <collisions> <physics>", "debug scene active|collisions|physics|scripting|teleport true|false",
"Turn on scene debugging", Debug); "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", m_console.Commands.AddCommand("General", false, "change region",
"change region <region name>", "change region <region name>",
@ -930,7 +936,8 @@ namespace OpenSim
} }
else 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; break;

View File

@ -306,6 +306,30 @@ namespace OpenSim.Region.Framework.Scenes
} }
private volatile bool m_shuttingDown; 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 int m_lastUpdate;
// private bool m_firstHeartbeat = true; // private bool m_firstHeartbeat = true;
@ -1159,6 +1183,14 @@ namespace OpenSim.Region.Framework.Scenes
public void SetSceneCoreDebug(Dictionary<string, string> options) 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")) if (options.ContainsKey("scripting"))
{ {
bool enableScripts = true; bool enableScripts = true;
@ -1298,6 +1330,8 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary> /// </summary>
public void Start() public void Start()
{ {
m_active = true;
// m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName); // m_log.DebugFormat("[SCENE]: Starting Heartbeat timer for {0}", RegionInfo.RegionName);
//m_heartbeatTimer.Enabled = true; //m_heartbeatTimer.Enabled = true;
@ -1339,7 +1373,7 @@ namespace OpenSim.Region.Framework.Scenes
#region Update Methods #region Update Methods
/// <summary> /// <summary>
/// Performs per-frame updates regularly /// Activate the various loops necessary to continually update the scene.
/// </summary> /// </summary>
private void Heartbeat() private void Heartbeat()
{ {
@ -1396,7 +1430,7 @@ namespace OpenSim.Region.Framework.Scenes
List<Vector3> coarseLocations; List<Vector3> coarseLocations;
List<UUID> avatarUUIDs; List<UUID> avatarUUIDs;
while (!m_shuttingDown && (endRun == null || MaintenanceRun < endRun)) while (Active && !m_shuttingDown && (endRun == null || MaintenanceRun < endRun))
{ {
runtc = Util.EnvironmentTickCount(); runtc = Util.EnvironmentTickCount();
++MaintenanceRun; ++MaintenanceRun;
@ -1455,7 +1489,7 @@ namespace OpenSim.Region.Framework.Scenes
int previousFrameTick, tmpMS; int previousFrameTick, tmpMS;
int maintc = Util.EnvironmentTickCount(); int maintc = Util.EnvironmentTickCount();
while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) while (Active && !m_shuttingDown && (endFrame == null || Frame < endFrame))
{ {
++Frame; ++Frame;