Add "show image queue <first-name> <last-name>" region console command

This is so that we can inspect the image download queue (texture download via udp) for debugging purposes.
This commit is contained in:
Justin Clark-Casey (justincc)
2012-01-10 21:30:12 +00:00
parent a2fe3e2081
commit ef074deb52
3 changed files with 107 additions and 6 deletions

View File

@@ -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 <first-name> <last-name>",
"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();
}
/// <summary>
/// Generate an image queue report
/// </summary>
/// <param name="showParams"></param>
/// <returns></returns>
private string GetImageQueuesReport(string[] showParams)
{
if (showParams.Length < 5 || showParams.Length > 6)
{
MainConsole.Instance.OutputFormat("Usage: show image queue <first-name> <last-name> [full]");
return "";
}
string firstName = showParams[3];
string lastName = showParams[4];
bool showChildAgents = showParams.Length == 6;
List<ScenePresence> foundAgents = new List<ScenePresence>();
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();
}
/// <summary>
/// Generate UDP Queue data report for each client