From 64f640f9019b0ecc65e1e2038acde306db425ebb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 26 Aug 2014 17:37:18 +0100
Subject: Implement experimental non-default mechanism to update scene via a
timer rather than a persistent thread with sleep.
This is to see if an inaccuracy in sleep times under load is responsible for increase in frame times even when there is spare time still available.
Can currently only be activated by setting "debug scene set update-on-timer true".
Can be switched between timer and thread with sleep updates whilst the scene is running.
---
.../World/SceneCommands/SceneCommandsModule.cs | 81 +++++++++++++---------
1 file changed, 50 insertions(+), 31 deletions(-)
(limited to 'OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs')
diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
index f2595c8..0927c4f 100644
--- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
+++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs
@@ -30,6 +30,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
+using System.Threading;
using log4net;
using Mono.Addins;
using Nini.Config;
@@ -93,42 +94,44 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
"Debug", this, "debug scene get",
"debug scene get",
"List current scene options.",
- "active - if false then main scene update and maintenance loops are suspended.\n"
- + "animations - if true then extra animations debug information is logged.\n"
- + "appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
- + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
- + "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
- + "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
- + "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
- + "root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
- + "child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
- + "collisions - if false then collisions with other objects are turned off.\n"
- + "pbackup - if false then periodic scene backup is turned off.\n"
- + "physics - if false then all physics objects are non-physical.\n"
- + "scripting - if false then no scripting operations happen.\n"
- + "teleport - if true then some extra teleport debug information is logged.\n"
- + "updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
+ "active - if false then main scene update and maintenance loops are suspended.\n"
+ + "animations - if true then extra animations debug information is logged.\n"
+ + "appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
+ + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
+ + "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ + "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ + "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
+ + "root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
+ + "child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
+ + "collisions - if false then collisions with other objects are turned off.\n"
+ + "pbackup - if false then periodic scene backup is turned off.\n"
+ + "physics - if false then all physics objects are non-physical.\n"
+ + "scripting - if false then no scripting operations happen.\n"
+ + "teleport - if true then some extra teleport debug information is logged.\n"
+ + "update-on-timer - If true then the scene is updated via a timer. If false then a thread with sleep is used.\n"
+ + "updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
HandleDebugSceneGetCommand);
scene.AddCommand(
"Debug", this, "debug scene set",
- "debug scene set active|collisions|pbackup|physics|scripting|teleport|updates true|false",
+ "debug scene set ",
"Turn on scene debugging options.",
- "active - if false then main scene update and maintenance loops are suspended.\n"
- + "animations - if true then extra animations debug information is logged.\n"
- + "appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
- + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
- + "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
- + "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
- + "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
- + "root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
- + "child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
- + "collisions - if false then collisions with other objects are turned off.\n"
- + "pbackup - if false then periodic scene backup is turned off.\n"
- + "physics - if false then all physics objects are non-physical.\n"
- + "scripting - if false then no scripting operations happen.\n"
- + "teleport - if true then some extra teleport debug information is logged.\n"
- + "updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
+ "active - if false then main scene update and maintenance loops are suspended.\n"
+ + "animations - if true then extra animations debug information is logged.\n"
+ + "appear-refresh - if true then appearance is resent to other avatars every 60 seconds.\n"
+ + "child-repri - how far an avatar must move in meters before we update the position of its child agents in neighbouring regions.\n"
+ + "client-pos-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ + "client-rot-upd - the tolerance before clients are updated with new rotation information for an avatar.\n"
+ + "client-vel-upd - the tolerance before clients are updated with new velocity information for an avatar.\n"
+ + "root-upd-per - if greater than 1, terse updates are only sent to root agents other than the originator on every n updates.\n"
+ + "child-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\n"
+ + "collisions - if false then collisions with other objects are turned off.\n"
+ + "pbackup - if false then periodic scene backup is turned off.\n"
+ + "physics - if false then all physics objects are non-physical.\n"
+ + "scripting - if false then no scripting operations happen.\n"
+ + "teleport - if true then some extra teleport debug information is logged.\n"
+ + "update-on-timer - If true then the scene is updated via a timer. If false then a thread with sleep is used.\n"
+ + "updates - if true then any frame which exceeds double the maximum desired frame time is logged.",
HandleDebugSceneSetCommand);
}
@@ -163,6 +166,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
cdl.AddRow("physics", m_scene.PhysicsEnabled);
cdl.AddRow("scripting", m_scene.ScriptsEnabled);
cdl.AddRow("teleport", m_scene.DebugTeleporting);
+ cdl.AddRow("update-on-timer", m_scene.UpdateOnTimer);
cdl.AddRow("updates", m_scene.DebugUpdates);
MainConsole.Instance.OutputFormat("Scene {0} options:", m_scene.Name);
@@ -304,6 +308,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments
m_scene.DebugTeleporting = enableTeleportDebugging;
}
+ if (options.ContainsKey("update-on-timer"))
+ {
+ bool enableUpdateOnTimer;
+ if (bool.TryParse(options["update-on-timer"], out enableUpdateOnTimer))
+ {
+ m_scene.UpdateOnTimer = enableUpdateOnTimer;
+ m_scene.Active = false;
+
+ while (m_scene.IsRunning)
+ Thread.Sleep(20);
+
+ m_scene.Active = true;
+ }
+ }
+
if (options.ContainsKey("updates"))
{
bool enableUpdateDebugging;
--
cgit v1.1