Fix "show queues" console command
For each agent, this command shows how many packets have been sent/received and how many bytes remain in each of the send queues (resend, land, texture, etc.) Sometimes useful for diagnosticsviewer-2-initial-appearance
parent
e6eeaaea67
commit
2a17c39dfe
|
@ -30,6 +30,7 @@ using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Text;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using log4net;
|
using log4net;
|
||||||
using Nini.Config;
|
using Nini.Config;
|
||||||
|
@ -988,38 +989,74 @@ namespace OpenSim
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
private string GetQueuesReport()
|
private string GetQueuesReport()
|
||||||
{
|
{
|
||||||
string report = String.Empty;
|
StringBuilder report = new StringBuilder();
|
||||||
|
|
||||||
m_sceneManager.ForEachScene(delegate(Scene scene)
|
int columnPadding = 2;
|
||||||
{
|
int maxNameLength = 18;
|
||||||
scene.ForEachClient(delegate(IClientAPI client)
|
int maxRegionNameLength = 14;
|
||||||
{
|
int maxTypeLength = 5;
|
||||||
if (client is IStatsCollector)
|
int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
|
||||||
{
|
|
||||||
report = report + client.FirstName +
|
|
||||||
" " + client.LastName;
|
|
||||||
|
|
||||||
IStatsCollector stats =
|
report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", "");
|
||||||
(IStatsCollector) client;
|
report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", "");
|
||||||
|
report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type", "");
|
||||||
|
|
||||||
report = report + string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}\n",
|
report.AppendFormat(
|
||||||
"Send",
|
"{0,9} {1,10} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7} {9,7}\n",
|
||||||
"In",
|
"Packets",
|
||||||
"Out",
|
"Packets",
|
||||||
|
"Bytes",
|
||||||
|
"Bytes",
|
||||||
|
"Bytes",
|
||||||
|
"Bytes",
|
||||||
|
"Bytes",
|
||||||
|
"Bytes",
|
||||||
|
"Bytes",
|
||||||
|
"Bytes");
|
||||||
|
|
||||||
|
report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", "");
|
||||||
|
report.AppendFormat(
|
||||||
|
"{0,9} {1,10} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7} {9,7}\n",
|
||||||
|
"Sent",
|
||||||
|
"Received",
|
||||||
"Resend",
|
"Resend",
|
||||||
"Land",
|
"Land",
|
||||||
"Wind",
|
"Wind",
|
||||||
"Cloud",
|
"Cloud",
|
||||||
"Task",
|
"Task",
|
||||||
"Texture",
|
"Texture",
|
||||||
"Asset");
|
"Asset",
|
||||||
report = report + stats.Report() +
|
"State");
|
||||||
"\n";
|
|
||||||
|
m_sceneManager.ForEachScene(
|
||||||
|
delegate(Scene scene)
|
||||||
|
{
|
||||||
|
scene.ForEachClient(
|
||||||
|
delegate(IClientAPI client)
|
||||||
|
{
|
||||||
|
if (client is IStatsCollector)
|
||||||
|
{
|
||||||
|
string name = client.Name;
|
||||||
|
string regionName = scene.RegionInfo.RegionName;
|
||||||
|
|
||||||
|
report.AppendFormat(
|
||||||
|
"{0,-" + maxNameLength + "}{1,-" + columnPadding + "}",
|
||||||
|
name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, "");
|
||||||
|
report.AppendFormat(
|
||||||
|
"{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}",
|
||||||
|
regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, "");
|
||||||
|
report.AppendFormat(
|
||||||
|
"{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}",
|
||||||
|
scene.PresenceChildStatus(client.AgentId) ? "Child" : "Root", "");
|
||||||
|
|
||||||
|
IStatsCollector stats = (IStatsCollector)client;
|
||||||
|
|
||||||
|
report.AppendLine(stats.Report());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return report;
|
return report.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -246,11 +246,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Return statistics information about client packet queues.
|
||||||
|
/// </summary>
|
||||||
|
///
|
||||||
|
/// FIXME: This should really be done in a more sensible manner rather than sending back a formatted string.
|
||||||
|
///
|
||||||
|
/// <returns></returns>
|
||||||
public string GetStats()
|
public string GetStats()
|
||||||
{
|
{
|
||||||
// TODO: ???
|
return string.Format(
|
||||||
return string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}",
|
"{0,9} {1,10} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7} {9,7}",
|
||||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
PacketsSent,
|
||||||
|
PacketsReceived,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.Resend].Content,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.Land].Content,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.Wind].Content,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.Cloud].Content,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.Task].Content,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.Texture].Content,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.Asset].Content,
|
||||||
|
m_throttleCategories[(int)ThrottleOutPacketType.State].Content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendPacketStats()
|
public void SendPacketStats()
|
||||||
|
|
Loading…
Reference in New Issue