diff options
author | Justin Clark-Casey (justincc) | 2011-01-21 00:38:16 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-01-21 00:38:16 +0000 |
commit | c383dbd06dd98ca96543c9bfdf9a7376a7e55cc2 (patch) | |
tree | 1cf85253c32484282141dcb99ba78f515fa025cc /OpenSim | |
parent | minor: help text adjustment for "show queues" (diff) | |
download | opensim-SC-c383dbd06dd98ca96543c9bfdf9a7376a7e55cc2.zip opensim-SC-c383dbd06dd98ca96543c9bfdf9a7376a7e55cc2.tar.gz opensim-SC-c383dbd06dd98ca96543c9bfdf9a7376a7e55cc2.tar.bz2 opensim-SC-c383dbd06dd98ca96543c9bfdf9a7376a7e55cc2.tar.xz |
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
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs (renamed from OpenSim/Region/CoreModules/Agent/UDP/Linden/LindenUDPModule.cs) | 150 |
3 files changed, 146 insertions, 13 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index e43e3c9..5dab1bc 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -368,6 +368,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
368 | #region Properties | 368 | #region Properties |
369 | 369 | ||
370 | public LLUDPClient UDPClient { get { return m_udpClient; } } | 370 | public LLUDPClient UDPClient { get { return m_udpClient; } } |
371 | public LLUDPServer UDPServer { get { return m_udpServer; } } | ||
371 | public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } } | 372 | public IPEndPoint RemoteEndPoint { get { return m_udpClient.RemoteEndPoint; } } |
372 | public UUID SecureSessionId { get { return m_secureSessionId; } } | 373 | public UUID SecureSessionId { get { return m_secureSessionId; } } |
373 | public IScene Scene { get { return m_scene; } } | 374 | public IScene Scene { get { return m_scene; } } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index 571624b..df8ddbb 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | |||
@@ -114,8 +114,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
114 | //private UDPClientCollection m_clients = new UDPClientCollection(); | 114 | //private UDPClientCollection m_clients = new UDPClientCollection(); |
115 | /// <summary>Bandwidth throttle for this UDP server</summary> | 115 | /// <summary>Bandwidth throttle for this UDP server</summary> |
116 | protected TokenBucket m_throttle; | 116 | protected TokenBucket m_throttle; |
117 | |||
117 | /// <summary>Bandwidth throttle rates for this UDP server</summary> | 118 | /// <summary>Bandwidth throttle rates for this UDP server</summary> |
118 | protected ThrottleRates m_throttleRates; | 119 | public ThrottleRates ThrottleRates { get; private set; } |
120 | |||
119 | /// <summary>Manages authentication for agent circuits</summary> | 121 | /// <summary>Manages authentication for agent circuits</summary> |
120 | private AgentCircuitManager m_circuitManager; | 122 | private AgentCircuitManager m_circuitManager; |
121 | /// <summary>Reference to the scene this UDP server is attached to</summary> | 123 | /// <summary>Reference to the scene this UDP server is attached to</summary> |
@@ -226,7 +228,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
226 | #endregion BinaryStats | 228 | #endregion BinaryStats |
227 | 229 | ||
228 | m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps); | 230 | m_throttle = new TokenBucket(null, sceneThrottleBps, sceneThrottleBps); |
229 | m_throttleRates = new ThrottleRates(configSource); | 231 | ThrottleRates = new ThrottleRates(configSource); |
230 | } | 232 | } |
231 | 233 | ||
232 | public void Start() | 234 | public void Start() |
@@ -922,7 +924,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
922 | protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) | 924 | protected virtual void AddClient(uint circuitCode, UUID agentID, UUID sessionID, IPEndPoint remoteEndPoint, AuthenticateResponse sessionInfo) |
923 | { | 925 | { |
924 | // Create the LLUDPClient | 926 | // Create the LLUDPClient |
925 | LLUDPClient udpClient = new LLUDPClient(this, m_throttleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); | 927 | LLUDPClient udpClient = new LLUDPClient(this, ThrottleRates, m_throttle, circuitCode, agentID, remoteEndPoint, m_defaultRTO, m_maxRTO); |
926 | IClientAPI existingClient; | 928 | IClientAPI existingClient; |
927 | 929 | ||
928 | if (!m_scene.TryGetClient(agentID, out existingClient)) | 930 | 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 index 29583dc..480df31 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; | |||
36 | using OpenSim.Framework; | 36 | using OpenSim.Framework; |
37 | using OpenSim.Framework.Console; | 37 | using OpenSim.Framework.Console; |
38 | using OpenSim.Framework.Statistics; | 38 | using OpenSim.Framework.Statistics; |
39 | using OpenSim.Region.ClientStack.LindenUDP; | ||
39 | using OpenSim.Region.Framework.Interfaces; | 40 | using OpenSim.Region.Framework.Interfaces; |
40 | using OpenSim.Region.Framework.Scenes; | 41 | using OpenSim.Region.Framework.Scenes; |
41 | 42 | ||
42 | namespace OpenSim.Region.CoreModules.UDP.Linden | 43 | namespace OpenSim.Region.CoreModules.UDP.Linden |
43 | { | 44 | { |
44 | /// <summary> | 45 | /// <summary> |
45 | /// A module that just holds commands for inspecting/changing the Linden UDP client stack | 46 | /// A module that just holds commands for inspecting the current state of the Linden UDP stack. |
46 | /// </summary> | 47 | /// </summary> |
47 | /// <remarks> | 48 | /// <remarks> |
48 | /// All actual client stack functionality remains in OpenSim.Region.ClientStack.LindenUDP | 49 | /// All actual client stack functionality remains in OpenSim.Region.ClientStack.LindenUDP |
49 | /// </remarks> | 50 | /// </remarks> |
50 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPModule")] | 51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] |
51 | public class LindenUDPModule : ISharedRegionModule | 52 | public class LindenUDPInfoModule : ISharedRegionModule |
52 | { | 53 | { |
53 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 54 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
54 | 55 | ||
@@ -60,22 +61,22 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
60 | 61 | ||
61 | public void Initialise(IConfigSource source) | 62 | public void Initialise(IConfigSource source) |
62 | { | 63 | { |
63 | // m_log.DebugFormat("[LINDEN UDP MODULE]: INITIALIZED MODULE"); | 64 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: INITIALIZED MODULE"); |
64 | } | 65 | } |
65 | 66 | ||
66 | public void PostInitialise() | 67 | public void PostInitialise() |
67 | { | 68 | { |
68 | // m_log.DebugFormat("[LINDEN UDP MODULE]: POST INITIALIZED MODULE"); | 69 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: POST INITIALIZED MODULE"); |
69 | } | 70 | } |
70 | 71 | ||
71 | public void Close() | 72 | public void Close() |
72 | { | 73 | { |
73 | // m_log.DebugFormat("[LINDEN UDP MODULE]: CLOSED MODULE"); | 74 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: CLOSED MODULE"); |
74 | } | 75 | } |
75 | 76 | ||
76 | public void AddRegion(Scene scene) | 77 | public void AddRegion(Scene scene) |
77 | { | 78 | { |
78 | // m_log.DebugFormat("[LINDEN UDP MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 79 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
79 | 80 | ||
80 | lock (m_scenes) | 81 | lock (m_scenes) |
81 | m_scenes[scene.RegionInfo.RegionID] = scene; | 82 | m_scenes[scene.RegionInfo.RegionID] = scene; |
@@ -86,12 +87,20 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
86 | "Show queue data for each client", | 87 | "Show queue data for each client", |
87 | "Without the 'full' option, only root agents are shown." | 88 | "Without the 'full' option, only root agents are shown." |
88 | + " With the 'full' option child agents are also shown.", | 89 | + " With the 'full' option child agents are also shown.", |
89 | ShowQueuesReport); | 90 | ShowQueuesReport); |
91 | |||
92 | scene.AddCommand( | ||
93 | this, "show throttles", | ||
94 | "show throttles [full]", | ||
95 | "Show throttle settings for each client and for the server overall", | ||
96 | "Without the 'full' option, only root agents are shown." | ||
97 | + " With the 'full' option child agents are also shown.", | ||
98 | ShowThrottlesReport); | ||
90 | } | 99 | } |
91 | 100 | ||
92 | public void RemoveRegion(Scene scene) | 101 | public void RemoveRegion(Scene scene) |
93 | { | 102 | { |
94 | // m_log.DebugFormat("[LINDEN UDP MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | 103 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); |
95 | 104 | ||
96 | lock (m_scenes) | 105 | lock (m_scenes) |
97 | m_scenes.Remove(scene.RegionInfo.RegionID); | 106 | m_scenes.Remove(scene.RegionInfo.RegionID); |
@@ -99,7 +108,7 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
99 | 108 | ||
100 | public void RegionLoaded(Scene scene) | 109 | public void RegionLoaded(Scene scene) |
101 | { | 110 | { |
102 | // m_log.DebugFormat("[LINDEN UDP MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 111 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
103 | } | 112 | } |
104 | 113 | ||
105 | protected void ShowQueuesReport(string module, string[] cmd) | 114 | protected void ShowQueuesReport(string module, string[] cmd) |
@@ -107,6 +116,11 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
107 | MainConsole.Instance.Output(GetQueuesReport(cmd)); | 116 | MainConsole.Instance.Output(GetQueuesReport(cmd)); |
108 | } | 117 | } |
109 | 118 | ||
119 | protected void ShowThrottlesReport(string module, string[] cmd) | ||
120 | { | ||
121 | MainConsole.Instance.Output(GetThrottlesReport(cmd)); | ||
122 | } | ||
123 | |||
110 | /// <summary> | 124 | /// <summary> |
111 | /// Generate UDP Queue data report for each client | 125 | /// Generate UDP Queue data report for each client |
112 | /// </summary> | 126 | /// </summary> |
@@ -195,6 +209,122 @@ namespace OpenSim.Region.CoreModules.UDP.Linden | |||
195 | } | 209 | } |
196 | 210 | ||
197 | return report.ToString(); | 211 | return report.ToString(); |
212 | } | ||
213 | |||
214 | /// <summary> | ||
215 | /// Show throttle data | ||
216 | /// </summary> | ||
217 | /// <param name="showParams"></param> | ||
218 | /// <returns></returns> | ||
219 | protected string GetThrottlesReport(string[] showParams) | ||
220 | { | ||
221 | bool showChildren = false; | ||
222 | |||
223 | if (showParams.Length > 2 && showParams[2] == "full") | ||
224 | showChildren = true; | ||
225 | |||
226 | StringBuilder report = new StringBuilder(); | ||
227 | |||
228 | int columnPadding = 2; | ||
229 | int maxNameLength = 18; | ||
230 | int maxRegionNameLength = 14; | ||
231 | int maxTypeLength = 4; | ||
232 | int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; | ||
233 | |||
234 | report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", ""); | ||
235 | report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", ""); | ||
236 | report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type\n", ""); | ||
237 | |||
238 | bool firstClient = true; | ||
239 | |||
240 | lock (m_scenes) | ||
241 | { | ||
242 | foreach (Scene scene in m_scenes.Values) | ||
243 | { | ||
244 | scene.ForEachClient( | ||
245 | delegate(IClientAPI client) | ||
246 | { | ||
247 | if (client is LLClientView) | ||
248 | { | ||
249 | LLClientView llClient = client as LLClientView; | ||
250 | |||
251 | if (firstClient) | ||
252 | { | ||
253 | report.AppendLine(GetServerThrottlesReport(llClient.UDPServer, scene)); | ||
254 | firstClient = false; | ||
255 | } | ||
256 | |||
257 | bool isChild = scene.PresenceChildStatus(client.AgentId); | ||
258 | if (isChild && !showChildren) | ||
259 | return; | ||
260 | |||
261 | string name = client.Name; | ||
262 | string regionName = scene.RegionInfo.RegionName; | ||
263 | |||
264 | LLUDPClient llUdpClient = llClient.UDPClient; | ||
265 | ClientInfo ci = llUdpClient.GetClientInfo(); | ||
266 | |||
267 | report.AppendFormat( | ||
268 | "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", | ||
269 | name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); | ||
270 | report.AppendFormat( | ||
271 | "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", | ||
272 | regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, ""); | ||
273 | report.AppendFormat( | ||
274 | "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", | ||
275 | isChild ? "Cd" : "Rt", ""); | ||
276 | |||
277 | report.Append((ci.totalThrottle * 8) / 1000 + " "); | ||
278 | report.Append((ci.resendThrottle * 8) / 1000 + " "); | ||
279 | report.Append((ci.landThrottle * 8) / 1000 + " "); | ||
280 | report.Append((ci.windThrottle * 8) / 1000 + " "); | ||
281 | report.Append((ci.cloudThrottle * 8) / 1000 + " "); | ||
282 | report.Append((ci.taskThrottle * 8) / 1000 + " "); | ||
283 | report.Append((ci.textureThrottle * 8) / 1000 + " "); | ||
284 | report.Append((ci.assetThrottle * 8) / 1000 + " "); | ||
285 | |||
286 | report.AppendLine(); | ||
287 | } | ||
288 | }); | ||
289 | } | ||
290 | } | ||
291 | |||
292 | return report.ToString(); | ||
198 | } | 293 | } |
294 | |||
295 | protected string GetServerThrottlesReport(LLUDPServer udpServer, Scene scene) | ||
296 | { | ||
297 | StringBuilder report = new StringBuilder(); | ||
298 | |||
299 | int columnPadding = 2; | ||
300 | int maxNameLength = 18; | ||
301 | int maxRegionNameLength = 14; | ||
302 | int maxTypeLength = 4; | ||
303 | int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; | ||
304 | |||
305 | string name = "SERVER LIMITS"; | ||
306 | string regionName = scene.RegionInfo.RegionName; | ||
307 | |||
308 | report.AppendFormat( | ||
309 | "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", | ||
310 | name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); | ||
311 | report.AppendFormat( | ||
312 | "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", | ||
313 | regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, ""); | ||
314 | report.AppendFormat( | ||
315 | "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "n/a", ""); | ||
316 | |||
317 | ThrottleRates throttleRates = udpServer.ThrottleRates; | ||
318 | report.Append("n/a"); | ||
319 | report.Append((throttleRates.ResendLimit * 8) / 1000 + " "); | ||
320 | report.Append((throttleRates.LandLimit * 8) / 1000 + " "); | ||
321 | report.Append((throttleRates.WindLimit * 8) / 1000 + " "); | ||
322 | report.Append((throttleRates.CloudLimit * 8) / 1000 + " "); | ||
323 | report.Append((throttleRates.TaskLimit * 8) / 1000 + " "); | ||
324 | report.Append((throttleRates.TextureLimit * 8) / 1000 + " "); | ||
325 | report.Append((throttleRates.AssetLimit * 8) / 1000 + " "); | ||
326 | |||
327 | return report.ToString(); | ||
328 | } | ||
199 | } | 329 | } |
200 | } \ No newline at end of file | 330 | } \ No newline at end of file |