From d19126207e5d9ab99516f4571e66ab396231cc50 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Tue, 29 Jul 2014 18:54:16 +0100 Subject: [PATCH] Implement "scene debug set root-upd-per" for dropping 1 in N root agent updates except to originator For experimental purposes. Also corrects a previous bug where each terse update sent was counted rather than each set of terse updates to agents. --- OpenSim/Region/Framework/Scenes/Scene.cs | 5 +++++ .../Region/Framework/Scenes/ScenePresence.cs | 21 ++++++++++++++++-- .../SceneCommands/SceneCommandsModule.cs | 22 ++++++++++++++----- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index d4727eea6d..5b747b4716 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -247,6 +247,11 @@ namespace OpenSim.Region.Framework.Scenes /// public float ClientVelocityUpdateTolerance { get; set; } + /// + /// If greater than 1, we only send terse updates to other root agents on every n updates. + /// + public int RootTerseUpdatePeriod { get; set; } + /// /// If greater than 1, we only send terse updates to child agents on every n updates. /// diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 5983e0f5b1..c6fac3d172 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3232,12 +3232,27 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendTerseUpdateToClient(IClientAPI remoteClient) { - m_terseUpdateCount++; - // If the client is inactive, it's getting its updates from another // server. if (remoteClient.IsActive) { + if (Scene.RootTerseUpdatePeriod > 1) + { +// Console.WriteLine( +// "{0} {1} {2} {3} {4} {5} for {6} to {7}", +// remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f), Name, remoteClient.Name); + if (remoteClient.AgentId != UUID + && !remoteClient.SceneAgent.IsChildAgent + && m_terseUpdateCount % Scene.RootTerseUpdatePeriod != 0 + && !Velocity.ApproxEquals(Vector3.Zero, 0.001f)) + { +// m_log.DebugFormat("[SCENE PRESENCE]: Discarded update from {0} to {1}, args {2} {3} {4} {5} {6} {7}", +// Name, remoteClient.Name, remoteClient.AgentId, UUID, remoteClient.SceneAgent.IsChildAgent, m_terseUpdateCount, Scene.RootTerseUpdatePeriod, Velocity.ApproxEquals(Vector3.Zero, 0.001f)); + + return; + } + } + if (Scene.ChildTerseUpdatePeriod > 1 && remoteClient.SceneAgent.IsChildAgent && m_terseUpdateCount % Scene.ChildTerseUpdatePeriod != 0 @@ -3303,6 +3318,8 @@ namespace OpenSim.Region.Framework.Scenes lastTerseUpdateToAllClientsTick = currentTick; lastPositionSentToAllClients = OffsetPosition; + m_terseUpdateCount++; + // Console.WriteLine("Scheduled update for {0} in {1}", Name, Scene.Name); m_scene.ForEachClient(SendTerseUpdateToClient); } diff --git a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs index 9e4f344876..0dc47f902e 100644 --- a/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs +++ b/OpenSim/Region/OptionalModules/World/SceneCommands/SceneCommandsModule.cs @@ -100,7 +100,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments + "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" - + "client-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\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" @@ -120,7 +121,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments + "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" - + "client-upd-per - if greater than 1, terse updates are only sent to child agents on every n updates.\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" @@ -155,7 +157,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments cdl.AddRow("client-pos-upd", m_scene.ClientPositionUpdateTolerance); cdl.AddRow("client-rot-upd", m_scene.ClientRotationUpdateTolerance); cdl.AddRow("client-vel-upd", m_scene.ClientVelocityUpdateTolerance); - cdl.AddRow("client-upd-per", m_scene.ChildTerseUpdatePeriod); + cdl.AddRow("root-upd-per", m_scene.RootTerseUpdatePeriod); + cdl.AddRow("child-upd-per", m_scene.ChildTerseUpdatePeriod); cdl.AddRow("pbackup", m_scene.PeriodicBackup); cdl.AddRow("physics", m_scene.PhysicsEnabled); cdl.AddRow("scripting", m_scene.ScriptsEnabled); @@ -248,12 +251,21 @@ namespace OpenSim.Region.OptionalModules.Avatar.Attachments m_scene.ClientVelocityUpdateTolerance = newValue; } - if (options.ContainsKey("client-upd-per")) + if (options.ContainsKey("root-upd-per")) { int newValue; // FIXME: This can only come from the console at the moment but might not always be true. - if (ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, options["client-upd-per"], out newValue)) + if (ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, options["root-upd-per"], out newValue)) + m_scene.RootTerseUpdatePeriod = newValue; + } + + if (options.ContainsKey("child-upd-per")) + { + int newValue; + + // FIXME: This can only come from the console at the moment but might not always be true. + if (ConsoleUtil.TryParseConsoleNaturalInt(MainConsole.Instance, options["child-upd-per"], out newValue)) m_scene.ChildTerseUpdatePeriod = newValue; }