diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e43e3c9b34..5dab1bc35e 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs @@ -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; } } diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 571624b36f..df8ddbbd8b 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -114,8 +114,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP //private UDPClientCollection m_clients = new UDPClientCollection(); /// Bandwidth throttle for this UDP server protected TokenBucket m_throttle; + /// Bandwidth throttle rates for this UDP server - protected ThrottleRates m_throttleRates; + public ThrottleRates ThrottleRates { get; private set; } + /// Manages authentication for agent circuits private AgentCircuitManager m_circuitManager; /// Reference to the scene this UDP server is attached to @@ -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)) diff --git a/OpenSim/Region/CoreModules/Agent/UDP/Linden/LindenUDPModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs similarity index 50% rename from OpenSim/Region/CoreModules/Agent/UDP/Linden/LindenUDPModule.cs rename to OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 29583dc210..480df31d7d 100644 --- a/OpenSim/Region/CoreModules/Agent/UDP/Linden/LindenUDPModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs @@ -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 { /// - /// 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. /// /// /// All actual client stack functionality remains in OpenSim.Region.ClientStack.LindenUDP /// - [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; @@ -86,12 +87,20 @@ 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 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)); + } + /// /// Generate UDP Queue data report for each client /// @@ -194,7 +208,123 @@ namespace OpenSim.Region.CoreModules.UDP.Linden } } + return report.ToString(); + } + + /// + /// Show throttle data + /// + /// + /// + 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(); + } } } \ No newline at end of file diff --git a/prebuild.xml b/prebuild.xml index 73cc81e717..0d6d6fb08d 100644 --- a/prebuild.xml +++ b/prebuild.xml @@ -1439,60 +1439,6 @@ - - - - ../../../bin/ - - - - - ../../../bin/ - - - - ../../../bin/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1606,6 +1552,61 @@ + + + + ../../../bin/ + + + + + ../../../bin/ + + + + ../../../bin/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +