From ef074deb52de617743ad50ea29e286dd9c66722d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 10 Jan 2012 21:30:12 +0000 Subject: Add "show image queue " region console command This is so that we can inspect the image download queue (texture download via udp) for debugging purposes. --- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 89 +++++++++++++++++++++- 1 file changed, 88 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/OptionalModules') diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index c754019..16f6821 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -95,7 +95,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden "Show queue data for each client", "Without the 'full' option, only root agents are shown." + " With the 'full' option child agents are also shown.", - ShowQueuesReport); + ShowQueuesReport); + + scene.AddCommand( + this, "show image queue", + "show image queue ", + "Show the image queue (textures downloaded via UDP) for a particular client.", + ShowImageQueuesReport); scene.AddCommand( this, "show throttles", @@ -135,6 +141,11 @@ namespace OpenSim.Region.CoreModules.UDP.Linden { MainConsole.Instance.Output(GetQueuesReport(cmd)); } + + protected void ShowImageQueuesReport(string module, string[] cmd) + { + MainConsole.Instance.Output(GetImageQueuesReport(cmd)); + } protected void ShowThrottlesReport(string module, string[] cmd) { @@ -240,6 +251,82 @@ namespace OpenSim.Region.CoreModules.UDP.Linden return report.ToString(); } + + /// + /// Generate an image queue report + /// + /// + /// + private string GetImageQueuesReport(string[] showParams) + { + if (showParams.Length < 5 || showParams.Length > 6) + { + MainConsole.Instance.OutputFormat("Usage: show image queue [full]"); + return ""; + } + + string firstName = showParams[3]; + string lastName = showParams[4]; + + bool showChildAgents = showParams.Length == 6; + + List foundAgents = new List(); + + lock (m_scenes) + { + foreach (Scene scene in m_scenes.Values) + { + ScenePresence sp = scene.GetScenePresence(firstName, lastName); + if (sp != null && (showChildAgents || !sp.IsChildAgent)) + foundAgents.Add(sp); + } + } + + if (foundAgents.Count == 0) + { + MainConsole.Instance.OutputFormat("No agents found for {0} {1}", firstName, lastName); + return ""; + } + + StringBuilder report = new StringBuilder(); + + foreach (ScenePresence agent in foundAgents) + { + LLClientView client = agent.ControllingClient as LLClientView; + + if (client == null) + { + MainConsole.Instance.OutputFormat("This command is only supported for LLClientView"); + return ""; + } + + J2KImage[] images = client.ImageManager.GetImages(); + + report.AppendFormat( + "In region {0} ({1} agent)\n", + agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root"); + report.AppendFormat("Images in queue: {0}\n", images.Length); + + if (images.Length > 0) + { + report.AppendFormat( + "{0,-36} {1,-8} {2,-9} {3,-9} {4,-9} {5,-7}\n", + "Texture ID", + "Last Seq", + "Priority", + "Start Pkt", + "Has Asset", + "Decoded"); + + foreach (J2KImage image in images) + report.AppendFormat( + "{0,36} {1,8} {2,9} {3,10} {4,9} {5,7}\n", + image.TextureID, image.LastSequence, image.Priority, image.StartPacket, image.HasAsset, image.IsDecoded); + } + } + + return report.ToString(); + } /// /// Generate UDP Queue data report for each client -- cgit v1.1 From 5002f06d24d3e9fde5d38ba8ee7e37bc9c139f89 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 10 Jan 2012 21:36:35 +0000 Subject: rename "show image queue" to "show image queues" in line with other udp info commands. Eliminate redundant one line methods --- .../Agent/UDP/Linden/LindenUDPInfoModule.cs | 37 +++++----------------- 1 file changed, 8 insertions(+), 29 deletions(-) (limited to 'OpenSim/Region/OptionalModules') diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 16f6821..58b9b9f 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -87,7 +87,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden "Show priority queue data for each client", "Without the 'full' option, only root agents are shown." + " With the 'full' option child agents are also shown.", - ShowPQueuesReport); + (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd))); scene.AddCommand( this, "show queues", @@ -95,13 +95,13 @@ namespace OpenSim.Region.CoreModules.UDP.Linden "Show queue data for each client", "Without the 'full' option, only root agents are shown." + " With the 'full' option child agents are also shown.", - ShowQueuesReport); + (mod, cmd) => MainConsole.Instance.Output(GetQueuesReport(cmd))); scene.AddCommand( - this, "show image queue", - "show image queue ", - "Show the image queue (textures downloaded via UDP) for a particular client.", - ShowImageQueuesReport); + this, "show image queues", + "show image queues ", + "Show the image queues (textures downloaded via UDP) for a particular client.", + (mod, cmd) => MainConsole.Instance.Output(GetImageQueuesReport(cmd))); scene.AddCommand( this, "show throttles", @@ -109,7 +109,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden "Show throttle settings for each client and for the server overall", "Without the 'full' option, only root agents are shown." + " With the 'full' option child agents are also shown.", - ShowThrottlesReport); + (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); scene.AddCommand( this, "emergency-monitoring", @@ -130,26 +130,6 @@ namespace OpenSim.Region.CoreModules.UDP.Linden public void RegionLoaded(Scene scene) { // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); - } - - protected void ShowPQueuesReport(string module, string[] cmd) - { - MainConsole.Instance.Output(GetPQueuesReport(cmd)); - } - - protected void ShowQueuesReport(string module, string[] cmd) - { - MainConsole.Instance.Output(GetQueuesReport(cmd)); - } - - protected void ShowImageQueuesReport(string module, string[] cmd) - { - MainConsole.Instance.Output(GetImageQueuesReport(cmd)); - } - - protected void ShowThrottlesReport(string module, string[] cmd) - { - MainConsole.Instance.Output(GetThrottlesReport(cmd)); } protected void EmergencyMonitoring(string module, string[] cmd) @@ -177,7 +157,6 @@ namespace OpenSim.Region.CoreModules.UDP.Linden entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, ""); } - /// /// Generate UDP Queue data report for each client @@ -261,7 +240,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden { if (showParams.Length < 5 || showParams.Length > 6) { - MainConsole.Instance.OutputFormat("Usage: show image queue [full]"); + MainConsole.Instance.OutputFormat("Usage: show image queues [full]"); return ""; } -- cgit v1.1