implement "show throttles" command for showing current agent throttles and the server settings.

This is in a very crude state, currently.
The LindenUDPModule was renamed LindenUDPInfoModule and moved to OptionalModules
OptionalModules was given a direct reference to OpenSim.Region.ClientStack.LindenUDP so that it can inspect specific LindenUDP settings without having to generalize those to all client views (some of which may have no concept of the settings involved).
This might be ess messy if OpenSim.Region.ClientStack.LindenUDP were a region module instead, like MXP, IRC and NPC
viewer-2-initial-appearance
Justin Clark-Casey (justincc) 2011-01-21 00:38:16 +00:00
parent 58eb6b5fa3
commit c383dbd06d
4 changed files with 201 additions and 67 deletions

View File

@ -368,6 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#region Properties
public LLUDPClient UDPClient { get { return m_udpClient; } }
public LLUDPServer UDPServer { get { return m_udpServer; } }
public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } }
public UUID SecureSessionId { get { return m_secureSessionId; } }
public IScene Scene { get { return m_scene; } }

View File

@ -114,8 +114,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
//private UDPClientCollection m_clients = new UDPClientCollection();
/// <summary>Bandwidth throttle for this UDP server</summary>
protected TokenBucket m_throttle;
/// <summary>Bandwidth throttle rates for this UDP server</summary>
protected ThrottleRates m_throttleRates;
public ThrottleRates ThrottleRates { get; private set; }
/// <summary>Manages authentication for agent circuits</summary>
private AgentCircuitManager m_circuitManager;
/// <summary>Reference to the scene this UDP server is attached to</summary>
@ -226,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
#endregion BinaryStats
m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps);
m_throttleRates = new ThrottleRates(configSource);
ThrottleRates = new ThrottleRates(configSource);
}
public void Start()
@ -922,7 +924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo)
{
// Create the LLUDPClient
LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO);
IClientAPI existingClient;
if (!m_scene.TryGetClient(agentID, out existingClient))

View File

@ -36,19 +36,20 @@ using OpenMetaverse;
using OpenSim.Framework;
using OpenSim.Framework.Console;
using OpenSim.Framework.Statistics;
using OpenSim.Region.ClientStack.LindenUDP;
using OpenSim.Region.Framework.Interfaces;
using OpenSim.Region.Framework.Scenes;
namespace OpenSim.Region.CoreModules.UDP.Linden
{
/// <summary>
/// A module that just holds commands for inspecting/changing the Linden UDP client stack
/// A module that just holds commands for inspecting the current state of the Linden UDP stack.
/// </summary>
/// <remarks>
/// All actual client stack functionality remains in OpenSim.Region.ClientStack.LindenUDP
/// </remarks>
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPModule")]
public class LindenUDPModule : ISharedRegionModule
[Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")]
public class LindenUDPInfoModule : ISharedRegionModule
{
private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -60,22 +61,22 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
public void Initialise(IConfigSource source)
{
// m_log.DebugFormat("[LINDEN UDP MODULE]: INITIALIZED MODULE");
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: INITIALIZED MODULE");
}
public void PostInitialise()
{
// m_log.DebugFormat("[LINDEN UDP MODULE]: POST INITIALIZED MODULE");
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: POST INITIALIZED MODULE");
}
public void Close()
{
// m_log.DebugFormat("[LINDEN UDP MODULE]: CLOSED MODULE");
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: CLOSED MODULE");
}
public void AddRegion(Scene scene)
{
// m_log.DebugFormat("[LINDEN UDP MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName);
lock (m_scenes)
m_scenes[scene.RegionInfo.RegionID] = scene;
@ -87,11 +88,19 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
"Without the 'full' option, only root agents are shown."
+ " With the 'full' option child agents are also shown.",
ShowQueuesReport);
scene.AddCommand(
this, "show throttles",
"show throttles [full]",
"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);
}
public void RemoveRegion(Scene scene)
{
// m_log.DebugFormat("[LINDEN UDP MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName);
lock (m_scenes)
m_scenes.Remove(scene.RegionInfo.RegionID);
@ -99,7 +108,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
public void RegionLoaded(Scene scene)
{
// m_log.DebugFormat("[LINDEN UDP MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
// m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName);
}
protected void ShowQueuesReport(string module, string[] cmd)
@ -107,6 +116,11 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
MainConsole.Instance.Output(GetQueuesReport(cmd));
}
protected void ShowThrottlesReport(string module, string[] cmd)
{
MainConsole.Instance.Output(GetThrottlesReport(cmd));
}
/// <summary>
/// Generate UDP Queue data report for each client
/// </summary>
@ -196,5 +210,121 @@ namespace OpenSim.Region.CoreModules.UDP.Linden
return report.ToString();
}
/// <summary>
/// Show throttle data
/// </summary>
/// <param name="showParams"></param>
/// <returns></returns>
protected string GetThrottlesReport(string[] showParams)
{
bool showChildren = false;
if (showParams.Length > 2 && showParams[2] == "full")
showChildren = true;
StringBuilder report = new StringBuilder();
int columnPadding = 2;
int maxNameLength = 18;
int maxRegionNameLength = 14;
int maxTypeLength = 4;
int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", "");
report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", "");
report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type\n", "");
bool firstClient = true;
lock (m_scenes)
{
foreach (Scene scene in m_scenes.Values)
{
scene.ForEachClient(
delegate(IClientAPI client)
{
if (client is LLClientView)
{
LLClientView llClient = client as LLClientView;
if (firstClient)
{
report.AppendLine(GetServerThrottlesReport(llClient.UDPServer, scene));
firstClient = false;
}
bool isChild = scene.PresenceChildStatus(client.AgentId);
if (isChild && !showChildren)
return;
string name = client.Name;
string regionName = scene.RegionInfo.RegionName;
LLUDPClient llUdpClient = llClient.UDPClient;
ClientInfo ci = llUdpClient.GetClientInfo();
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 + "}",
isChild ? "Cd" : "Rt", "");
report.Append((ci.totalThrottle * 8) / 1000 + " ");
report.Append((ci.resendThrottle * 8) / 1000 + " ");
report.Append((ci.landThrottle * 8) / 1000 + " ");
report.Append((ci.windThrottle * 8) / 1000 + " ");
report.Append((ci.cloudThrottle * 8) / 1000 + " ");
report.Append((ci.taskThrottle * 8) / 1000 + " ");
report.Append((ci.textureThrottle * 8) / 1000 + " ");
report.Append((ci.assetThrottle * 8) / 1000 + " ");
report.AppendLine();
}
});
}
}
return report.ToString();
}
protected string GetServerThrottlesReport(LLUDPServer udpServer, Scene scene)
{
StringBuilder report = new StringBuilder();
int columnPadding = 2;
int maxNameLength = 18;
int maxRegionNameLength = 14;
int maxTypeLength = 4;
int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding;
string name = "SERVER LIMITS";
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 + "}", "n/a", "");
ThrottleRates throttleRates = udpServer.ThrottleRates;
report.Append("n/a");
report.Append((throttleRates.ResendLimit * 8) / 1000 + " ");
report.Append((throttleRates.LandLimit * 8) / 1000 + " ");
report.Append((throttleRates.WindLimit * 8) / 1000 + " ");
report.Append((throttleRates.CloudLimit * 8) / 1000 + " ");
report.Append((throttleRates.TaskLimit * 8) / 1000 + " ");
report.Append((throttleRates.TextureLimit * 8) / 1000 + " ");
report.Append((throttleRates.AssetLimit * 8) / 1000 + " ");
return report.ToString();
}
}
}

View File

@ -1439,60 +1439,6 @@
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="System.Drawing"/>
<Reference name="System.Web"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="PumaCode.SvnDotNet" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Framework.Capabilities"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Server.Handlers"/>
<Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<!-- For scripting in funny languages by default -->
<Reference name="XMLRPC" path="../../../bin/"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="DotNetOpenMail" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="Tests" pattern="Tests"/>
</Match>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.RegionCombinerModule" path="OpenSim/Region/RegionCombinerModule" type="Library">
<Configuration name="Debug">
<Options>
@ -1606,6 +1552,61 @@
</Files>
</Project>
<Project frameworkVersion="v3_5" name="OpenSim.Region.OptionalModules" path="OpenSim/Region/OptionalModules" type="Library">
<Configuration name="Debug">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<Configuration name="Release">
<Options>
<OutputPath>../../../bin/</OutputPath>
</Options>
</Configuration>
<ReferencePath>../../../bin/</ReferencePath>
<Reference name="System"/>
<Reference name="System.Xml"/>
<Reference name="System.Drawing"/>
<Reference name="System.Web"/>
<Reference name="OpenMetaverseTypes" path="../../../bin/"/>
<Reference name="OpenMetaverse.StructuredData" path="../../../bin/"/>
<Reference name="OpenMetaverse" path="../../../bin/"/>
<Reference name="PumaCode.SvnDotNet" path="../../../bin/"/>
<Reference name="OpenSim.Framework"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="OpenSim.Data"/>
<Reference name="OpenSim.Framework.Capabilities"/>
<Reference name="OpenSim.Framework.Console"/>
<Reference name="OpenSim.Framework.Servers"/>
<Reference name="OpenSim.Framework.Servers.HttpServer"/>
<Reference name="OpenSim.Framework.Statistics"/>
<Reference name="OpenSim.Region.ClientStack.LindenUDP"/>
<Reference name="OpenSim.Region.CoreModules"/>
<Reference name="OpenSim.Region.Framework"/>
<Reference name="OpenSim.Region.Physics.Manager"/>
<Reference name="OpenSim.Server.Base"/>
<Reference name="OpenSim.Server.Handlers"/>
<Reference name="OpenSim.Services.Connectors"/>
<Reference name="OpenSim.Services.Base"/>
<Reference name="OpenSim.Services.Interfaces"/>
<Reference name="Mono.Addins" path="../../../bin/"/>
<!-- For scripting in funny languages by default -->
<Reference name="XMLRPC" path="../../../bin/"/>
<Reference name="OpenSim.Framework.Communications"/>
<Reference name="Nini" path="../../../bin/"/>
<Reference name="log4net" path="../../../bin/"/>
<Reference name="DotNetOpenMail" path="../../../bin/"/>
<Files>
<Match pattern="*.cs" recurse="true">
<Exclude name="Tests" pattern="Tests"/>
</Match>
<Match buildAction="EmbeddedResource" path="Resources" pattern="*.addin.xml" recurse="true"/>
</Files>
</Project>
<!-- Datastore Plugins -->
<Project frameworkVersion="v3_5" name="OpenSim.Data.Null" path="OpenSim/Data/Null" type="Library">
<Configuration name="Debug">