diff options
author | onefang | 2019-05-19 21:24:15 +1000 |
---|---|---|
committer | onefang | 2019-05-19 21:24:15 +1000 |
commit | 5e4d6cab00cb29cd088ab7b62ab13aff103b64cb (patch) | |
tree | a9fbc62df9eb2d1d9ba2698d8552eae71eca20d8 /OpenSim/Region/OptionalModules/Agent/UDP/Linden | |
parent | Add a build script. (diff) | |
download | opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.zip opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.gz opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.bz2 opensim-SC-5e4d6cab00cb29cd088ab7b62ab13aff103b64cb.tar.xz |
Dump OpenSim 0.9.0.1 into it's own branch.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Agent/UDP/Linden')
-rw-r--r-- | OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | 299 |
1 files changed, 82 insertions, 217 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 08d0fbf..490809e 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -52,48 +52,48 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
52 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] | 52 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] |
53 | public class LindenUDPInfoModule : ISharedRegionModule | 53 | public class LindenUDPInfoModule : ISharedRegionModule |
54 | { | 54 | { |
55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
56 | 56 | ||
57 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 57 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
58 | 58 | ||
59 | public string Name { get { return "Linden UDP Module"; } } | 59 | public string Name { get { return "Linden UDP Module"; } } |
60 | 60 | ||
61 | public Type ReplaceableInterface { get { return null; } } | 61 | public Type ReplaceableInterface { get { return null; } } |
62 | 62 | ||
63 | public void Initialise(IConfigSource source) | 63 | public void Initialise(IConfigSource source) |
64 | { | 64 | { |
65 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: INITIALIZED MODULE"); | 65 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: INITIALIZED MODULE"); |
66 | } | 66 | } |
67 | 67 | ||
68 | public void PostInitialise() | 68 | public void PostInitialise() |
69 | { | 69 | { |
70 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: POST INITIALIZED MODULE"); | 70 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: POST INITIALIZED MODULE"); |
71 | } | 71 | } |
72 | 72 | ||
73 | public void Close() | 73 | public void Close() |
74 | { | 74 | { |
75 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: CLOSED MODULE"); | 75 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: CLOSED MODULE"); |
76 | } | 76 | } |
77 | 77 | ||
78 | public void AddRegion(Scene scene) | 78 | public void AddRegion(Scene scene) |
79 | { | 79 | { |
80 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); | 80 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); |
81 | 81 | ||
82 | lock (m_scenes) | 82 | lock (m_scenes) |
83 | m_scenes[scene.RegionInfo.RegionID] = scene; | 83 | m_scenes[scene.RegionInfo.RegionID] = scene; |
84 | 84 | ||
85 | scene.AddCommand( | 85 | scene.AddCommand( |
86 | "Comms", this, "show pqueues", | 86 | "Comms", this, "show pqueues", |
87 | "show pqueues [full]", | 87 | "show pqueues [full]", |
88 | "Show priority queue data for each client", | 88 | "Show priority queue data for each client", |
89 | "Without the 'full' option, only root agents are shown." | 89 | "Without the 'full' option, only root agents are shown." |
90 | + " With the 'full' option child agents are also shown.", | 90 | + " With the 'full' option child agents are also shown.", |
91 | (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd))); | 91 | (mod, cmd) => MainConsole.Instance.Output(GetPQueuesReport(cmd))); |
92 | 92 | ||
93 | scene.AddCommand( | 93 | scene.AddCommand( |
94 | "Comms", this, "show queues", | 94 | "Comms", this, "show queues", |
95 | "show queues [full]", | 95 | "show queues [full]", |
96 | "Show queue data for each client", | 96 | "Show queue data for each client", |
97 | "Without the 'full' option, only root agents are shown.\n" | 97 | "Without the 'full' option, only root agents are shown.\n" |
98 | + "With the 'full' option child agents are also shown.\n\n" | 98 | + "With the 'full' option child agents are also shown.\n\n" |
99 | + "Type - Rt is a root (avatar) client whilst cd is a child (neighbour interacting) client.\n" | 99 | + "Type - Rt is a root (avatar) client whilst cd is a child (neighbour interacting) client.\n" |
@@ -116,40 +116,24 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
116 | "clear image queues <first-name> <last-name>", | 116 | "clear image queues <first-name> <last-name>", |
117 | "Clear the image queues (textures downloaded via UDP) for a particular client.", | 117 | "Clear the image queues (textures downloaded via UDP) for a particular client.", |
118 | (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd))); | 118 | (mod, cmd) => MainConsole.Instance.Output(HandleImageQueuesClear(cmd))); |
119 | 119 | ||
120 | scene.AddCommand( | 120 | scene.AddCommand( |
121 | "Comms", this, "show throttles", | 121 | "Comms", this, "show throttles", |
122 | "show throttles [full]", | 122 | "show throttles [full]", |
123 | "Show throttle settings for each client and for the server overall", | 123 | "Show throttle settings for each client and for the server overall", |
124 | "Without the 'full' option, only root agents are shown." | 124 | "Without the 'full' option, only root agents are shown." |
125 | + " With the 'full' option child agents are also shown.", | 125 | + " With the 'full' option child agents are also shown.", |
126 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); | 126 | (mod, cmd) => MainConsole.Instance.Output(GetThrottlesReport(cmd))); |
127 | |||
128 | scene.AddCommand( | ||
129 | "Comms", this, "emergency-monitoring", | ||
130 | "emergency-monitoring", | ||
131 | "Go on/off emergency monitoring mode", | ||
132 | "Go on/off emergency monitoring mode", | ||
133 | HandleEmergencyMonitoring); | ||
134 | |||
135 | scene.AddCommand( | ||
136 | "Comms", this, "show client stats", | ||
137 | "show client stats [first_name last_name]", | ||
138 | "Show client request stats", | ||
139 | "Without the 'first_name last_name' option, all clients are shown." | ||
140 | + " With the 'first_name last_name' option only a specific client is shown.", | ||
141 | (mod, cmd) => MainConsole.Instance.Output(HandleClientStatsReport(cmd))); | ||
142 | |||
143 | } | 127 | } |
144 | 128 | ||
145 | public void RemoveRegion(Scene scene) | 129 | public void RemoveRegion(Scene scene) |
146 | { | 130 | { |
147 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); | 131 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); |
148 | 132 | ||
149 | lock (m_scenes) | 133 | lock (m_scenes) |
150 | m_scenes.Remove(scene.RegionInfo.RegionID); | 134 | m_scenes.Remove(scene.RegionInfo.RegionID); |
151 | } | 135 | } |
152 | 136 | ||
153 | public void RegionLoaded(Scene scene) | 137 | public void RegionLoaded(Scene scene) |
154 | { | 138 | { |
155 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); | 139 | // m_log.DebugFormat("[LINDEN UDP INFO MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); |
@@ -183,7 +167,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
183 | foreach (ScenePresence agent in foundAgents) | 167 | foreach (ScenePresence agent in foundAgents) |
184 | { | 168 | { |
185 | LLClientView client = agent.ControllingClient as LLClientView; | 169 | LLClientView client = agent.ControllingClient as LLClientView; |
186 | 170 | ||
187 | if (client == null) | 171 | if (client == null) |
188 | return "This command is only supported for LLClientView"; | 172 | return "This command is only supported for LLClientView"; |
189 | 173 | ||
@@ -197,29 +181,11 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
197 | return report.ToString(); | 181 | return report.ToString(); |
198 | } | 182 | } |
199 | 183 | ||
200 | protected void HandleEmergencyMonitoring(string module, string[] cmd) | ||
201 | { | ||
202 | bool mode = true; | ||
203 | if (cmd.Length == 1 || (cmd.Length > 1 && cmd[1] == "on")) | ||
204 | { | ||
205 | mode = true; | ||
206 | MainConsole.Instance.Output("Emergency Monitoring ON"); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | mode = false; | ||
211 | MainConsole.Instance.Output("Emergency Monitoring OFF"); | ||
212 | } | ||
213 | |||
214 | foreach (Scene s in m_scenes.Values) | ||
215 | s.EmergencyMonitoring = mode; | ||
216 | } | ||
217 | |||
218 | protected string GetColumnEntry(string entry, int maxLength, int columnPadding) | 184 | protected string GetColumnEntry(string entry, int maxLength, int columnPadding) |
219 | { | 185 | { |
220 | return string.Format( | 186 | return string.Format( |
221 | "{0,-" + maxLength + "}{1,-" + columnPadding + "}", | 187 | "{0,-" + maxLength + "}{1,-" + columnPadding + "}", |
222 | entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, | 188 | entry.Length > maxLength ? entry.Substring(0, maxLength) : entry, |
223 | ""); | 189 | ""); |
224 | } | 190 | } |
225 | 191 | ||
@@ -232,29 +198,29 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
232 | { | 198 | { |
233 | bool showChildren = false; | 199 | bool showChildren = false; |
234 | string pname = ""; | 200 | string pname = ""; |
235 | 201 | ||
236 | if (showParams.Length > 2 && showParams[2] == "full") | 202 | if (showParams.Length > 2 && showParams[2] == "full") |
237 | showChildren = true; | 203 | showChildren = true; |
238 | else if (showParams.Length > 3) | 204 | else if (showParams.Length > 3) |
239 | pname = showParams[2] + " " + showParams[3]; | 205 | pname = showParams[2] + " " + showParams[3]; |
240 | 206 | ||
241 | StringBuilder report = new StringBuilder(); | 207 | StringBuilder report = new StringBuilder(); |
242 | 208 | ||
243 | int columnPadding = 2; | 209 | int columnPadding = 2; |
244 | int maxNameLength = 18; | 210 | int maxNameLength = 18; |
245 | int maxRegionNameLength = 14; | 211 | int maxRegionNameLength = 14; |
246 | int maxTypeLength = 4; | 212 | int maxTypeLength = 4; |
247 | // int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; | 213 | // int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; |
248 | 214 | ||
249 | report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); | 215 | report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); |
250 | report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); | 216 | report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); |
251 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); | 217 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); |
252 | 218 | ||
253 | report.AppendFormat( | 219 | report.AppendFormat( |
254 | "{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7} {10,7} {11,7}\n", | 220 | "{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7} {10,7} {11,7}\n", |
255 | "Pri 0", | 221 | "Pri 0", |
256 | "Pri 1", | 222 | "Pri 1", |
257 | "Pri 2", | 223 | "Pri 2", |
258 | "Pri 3", | 224 | "Pri 3", |
259 | "Pri 4", | 225 | "Pri 4", |
260 | "Pri 5", | 226 | "Pri 5", |
@@ -277,16 +243,16 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
277 | bool isChild = client.SceneAgent.IsChildAgent; | 243 | bool isChild = client.SceneAgent.IsChildAgent; |
278 | if (isChild && !showChildren) | 244 | if (isChild && !showChildren) |
279 | return; | 245 | return; |
280 | 246 | ||
281 | string name = client.Name; | 247 | string name = client.Name; |
282 | if (pname != "" && name != pname) | 248 | if (pname != "" && name != pname) |
283 | return; | 249 | return; |
284 | 250 | ||
285 | string regionName = scene.RegionInfo.RegionName; | 251 | string regionName = scene.RegionInfo.RegionName; |
286 | 252 | ||
287 | report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); | 253 | report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); |
288 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); | 254 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); |
289 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); | 255 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); |
290 | report.AppendLine(((LLClientView)client).EntityUpdateQueue.ToString()); | 256 | report.AppendLine(((LLClientView)client).EntityUpdateQueue.ToString()); |
291 | } | 257 | } |
292 | }); | 258 | }); |
@@ -331,17 +297,17 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
331 | foreach (ScenePresence agent in foundAgents) | 297 | foreach (ScenePresence agent in foundAgents) |
332 | { | 298 | { |
333 | LLClientView client = agent.ControllingClient as LLClientView; | 299 | LLClientView client = agent.ControllingClient as LLClientView; |
334 | 300 | ||
335 | if (client == null) | 301 | if (client == null) |
336 | return "This command is only supported for LLClientView"; | 302 | return "This command is only supported for LLClientView"; |
337 | 303 | ||
338 | J2KImage[] images = client.ImageManager.GetImages(); | 304 | J2KImage[] images = client.ImageManager.GetImages(); |
339 | 305 | ||
340 | report.AppendFormat( | 306 | report.AppendFormat( |
341 | "In region {0} ({1} agent)\n", | 307 | "In region {0} ({1} agent)\n", |
342 | agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root"); | 308 | agent.Scene.RegionInfo.RegionName, agent.IsChildAgent ? "child" : "root"); |
343 | report.AppendFormat("Images in queue: {0}\n", images.Length); | 309 | report.AppendFormat("Images in queue: {0}\n", images.Length); |
344 | 310 | ||
345 | if (images.Length > 0) | 311 | if (images.Length > 0) |
346 | { | 312 | { |
347 | report.AppendFormat( | 313 | report.AppendFormat( |
@@ -352,7 +318,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
352 | "Start Pkt", | 318 | "Start Pkt", |
353 | "Has Asset", | 319 | "Has Asset", |
354 | "Decoded"); | 320 | "Decoded"); |
355 | 321 | ||
356 | foreach (J2KImage image in images) | 322 | foreach (J2KImage image in images) |
357 | report.AppendFormat( | 323 | report.AppendFormat( |
358 | "{0,36} {1,8} {2,10} {3,10} {4,9} {5,7}\n", | 324 | "{0,36} {1,8} {2,10} {3,10} {4,9} {5,7}\n", |
@@ -362,7 +328,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
362 | 328 | ||
363 | return report.ToString(); | 329 | return report.ToString(); |
364 | } | 330 | } |
365 | 331 | ||
366 | /// <summary> | 332 | /// <summary> |
367 | /// Generate UDP Queue data report for each client | 333 | /// Generate UDP Queue data report for each client |
368 | /// </summary> | 334 | /// </summary> |
@@ -372,16 +338,16 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
372 | { | 338 | { |
373 | bool showChildren = false; | 339 | bool showChildren = false; |
374 | string pname = ""; | 340 | string pname = ""; |
375 | 341 | ||
376 | if (showParams.Length > 2 && showParams[2] == "full") | 342 | if (showParams.Length > 2 && showParams[2] == "full") |
377 | showChildren = true; | 343 | showChildren = true; |
378 | else if (showParams.Length > 3) | 344 | else if (showParams.Length > 3) |
379 | pname = showParams[2] + " " + showParams[3]; | 345 | pname = showParams[2] + " " + showParams[3]; |
380 | 346 | ||
381 | StringBuilder report = new StringBuilder(); | 347 | StringBuilder report = new StringBuilder(); |
382 | 348 | ||
383 | int columnPadding = 2; | 349 | int columnPadding = 2; |
384 | int maxNameLength = 18; | 350 | int maxNameLength = 18; |
385 | int maxRegionNameLength = 14; | 351 | int maxRegionNameLength = 14; |
386 | int maxTypeLength = 4; | 352 | int maxTypeLength = 4; |
387 | 353 | ||
@@ -389,11 +355,11 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
389 | = maxNameLength + columnPadding | 355 | = maxNameLength + columnPadding |
390 | + maxRegionNameLength + columnPadding | 356 | + maxRegionNameLength + columnPadding |
391 | + maxTypeLength + columnPadding; | 357 | + maxTypeLength + columnPadding; |
392 | 358 | ||
393 | report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); | 359 | report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); |
394 | report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); | 360 | report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); |
395 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); | 361 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); |
396 | 362 | ||
397 | report.AppendFormat( | 363 | report.AppendFormat( |
398 | "{0,7} {1,7} {2,7} {3,7} {4,9} {5,7} {6,7} {7,7} {8,7} {9,7} {10,8} {11,7}\n", | 364 | "{0,7} {1,7} {2,7} {3,7} {4,9} {5,7} {6,7} {7,7} {8,7} {9,7} {10,8} {11,7}\n", |
399 | "Since", | 365 | "Since", |
@@ -408,7 +374,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
408 | "Q Pkts", | 374 | "Q Pkts", |
409 | "Q Pkts", | 375 | "Q Pkts", |
410 | "Q Pkts"); | 376 | "Q Pkts"); |
411 | 377 | ||
412 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); | 378 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); |
413 | report.AppendFormat( | 379 | report.AppendFormat( |
414 | "{0,7} {1,7} {2,7} {3,7} {4,9} {5,7} {6,7} {7,7} {8,7} {9,7} {10,8} {11,7}\n", | 380 | "{0,7} {1,7} {2,7} {3,7} {4,9} {5,7} {6,7} {7,7} {8,7} {9,7} {10,8} {11,7}\n", |
@@ -423,8 +389,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
423 | "Cloud", | 389 | "Cloud", |
424 | "Task", | 390 | "Task", |
425 | "Texture", | 391 | "Texture", |
426 | "Asset"); | 392 | "Asset"); |
427 | 393 | ||
428 | lock (m_scenes) | 394 | lock (m_scenes) |
429 | { | 395 | { |
430 | foreach (Scene scene in m_scenes.Values) | 396 | foreach (Scene scene in m_scenes.Values) |
@@ -438,7 +404,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
438 | bool isChild = client.SceneAgent.IsChildAgent; | 404 | bool isChild = client.SceneAgent.IsChildAgent; |
439 | if (isChild && !showChildren) | 405 | if (isChild && !showChildren) |
440 | return; | 406 | return; |
441 | 407 | ||
442 | string name = client.Name; | 408 | string name = client.Name; |
443 | if (pname != "" && name != pname) | 409 | if (pname != "" && name != pname) |
444 | return; | 410 | return; |
@@ -449,7 +415,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
449 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); | 415 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); |
450 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); | 416 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); |
451 | 417 | ||
452 | IStatsCollector stats = (IStatsCollector)client; | 418 | IStatsCollector stats = (IStatsCollector)client; |
453 | report.AppendLine(stats.Report()); | 419 | report.AppendLine(stats.Report()); |
454 | } | 420 | } |
455 | }); | 421 | }); |
@@ -457,8 +423,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
457 | } | 423 | } |
458 | 424 | ||
459 | return report.ToString(); | 425 | return report.ToString(); |
460 | } | 426 | } |
461 | 427 | ||
462 | /// <summary> | 428 | /// <summary> |
463 | /// Show throttle data | 429 | /// Show throttle data |
464 | /// </summary> | 430 | /// </summary> |
@@ -468,28 +434,28 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
468 | { | 434 | { |
469 | bool showChildren = false; | 435 | bool showChildren = false; |
470 | string pname = ""; | 436 | string pname = ""; |
471 | 437 | ||
472 | if (showParams.Length > 2 && showParams[2] == "full") | 438 | if (showParams.Length > 2 && showParams[2] == "full") |
473 | showChildren = true; | 439 | showChildren = true; |
474 | else if (showParams.Length > 3) | 440 | else if (showParams.Length > 3) |
475 | pname = showParams[2] + " " + showParams[3]; | 441 | pname = showParams[2] + " " + showParams[3]; |
476 | 442 | ||
477 | StringBuilder report = new StringBuilder(); | 443 | StringBuilder report = new StringBuilder(); |
478 | 444 | ||
479 | int columnPadding = 2; | 445 | int columnPadding = 2; |
480 | int maxNameLength = 18; | 446 | int maxNameLength = 18; |
481 | int maxRegionNameLength = 14; | 447 | int maxRegionNameLength = 14; |
482 | int maxTypeLength = 4; | 448 | int maxTypeLength = 4; |
483 | int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; | 449 | int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; |
484 | 450 | ||
485 | report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); | 451 | report.Append(GetColumnEntry("User", maxNameLength, columnPadding)); |
486 | report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); | 452 | report.Append(GetColumnEntry("Region", maxRegionNameLength, columnPadding)); |
487 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); | 453 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); |
488 | 454 | ||
489 | report.AppendFormat( | 455 | report.AppendFormat( |
490 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", | 456 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", |
491 | "Max", | 457 | "Max", |
492 | "Target", | 458 | "Target", |
493 | "Actual", | 459 | "Actual", |
494 | "Resend", | 460 | "Resend", |
495 | "Land", | 461 | "Land", |
@@ -497,8 +463,8 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
497 | "Cloud", | 463 | "Cloud", |
498 | "Task", | 464 | "Task", |
499 | "Texture", | 465 | "Texture", |
500 | "Asset"); | 466 | "Asset"); |
501 | 467 | ||
502 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); | 468 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); |
503 | report.AppendFormat( | 469 | report.AppendFormat( |
504 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", | 470 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", |
@@ -511,10 +477,10 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
511 | "kb/s", | 477 | "kb/s", |
512 | "kb/s", | 478 | "kb/s", |
513 | "kb/s", | 479 | "kb/s", |
514 | "kb/s"); | 480 | "kb/s"); |
515 | 481 | ||
516 | report.AppendLine(); | 482 | report.AppendLine(); |
517 | 483 | ||
518 | lock (m_scenes) | 484 | lock (m_scenes) |
519 | { | 485 | { |
520 | foreach (Scene scene in m_scenes.Values) | 486 | foreach (Scene scene in m_scenes.Values) |
@@ -529,25 +495,25 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
529 | bool isChild = client.SceneAgent.IsChildAgent; | 495 | bool isChild = client.SceneAgent.IsChildAgent; |
530 | if (isChild && !showChildren) | 496 | if (isChild && !showChildren) |
531 | return; | 497 | return; |
532 | 498 | ||
533 | string name = client.Name; | 499 | string name = client.Name; |
534 | if (pname != "" && name != pname) | 500 | if (pname != "" && name != pname) |
535 | return; | 501 | return; |
536 | 502 | ||
537 | string regionName = scene.RegionInfo.RegionName; | 503 | string regionName = scene.RegionInfo.RegionName; |
538 | 504 | ||
539 | LLUDPClient llUdpClient = llClient.UDPClient; | 505 | LLUDPClient llUdpClient = llClient.UDPClient; |
540 | ClientInfo ci = llUdpClient.GetClientInfo(); | 506 | ClientInfo ci = llUdpClient.GetClientInfo(); |
541 | 507 | ||
542 | report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); | 508 | report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); |
543 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); | 509 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); |
544 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); | 510 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); |
545 | 511 | ||
546 | report.AppendFormat( | 512 | report.AppendFormat( |
547 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", | 513 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", |
548 | ci.maxThrottle > 0 ? ((ci.maxThrottle * 8) / 1000).ToString() : "-", | 514 | ci.maxThrottle > 0 ? ((ci.maxThrottle * 8) / 1000).ToString() : "-", |
549 | llUdpClient.FlowThrottle.AdaptiveEnabled | 515 | llUdpClient.FlowThrottle.AdaptiveEnabled |
550 | ? ((ci.targetThrottle * 8) / 1000).ToString() | 516 | ? ((ci.targetThrottle * 8) / 1000).ToString() |
551 | : (llUdpClient.FlowThrottle.TotalDripRequest * 8 / 1000).ToString(), | 517 | : (llUdpClient.FlowThrottle.TotalDripRequest * 8 / 1000).ToString(), |
552 | (ci.totalThrottle * 8) / 1000, | 518 | (ci.totalThrottle * 8) / 1000, |
553 | (ci.resendThrottle * 8) / 1000, | 519 | (ci.resendThrottle * 8) / 1000, |
@@ -563,107 +529,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
563 | } | 529 | } |
564 | 530 | ||
565 | return report.ToString(); | 531 | return report.ToString(); |
566 | } | ||
567 | |||
568 | /// <summary> | ||
569 | /// Show client stats data | ||
570 | /// </summary> | ||
571 | /// <param name="showParams"></param> | ||
572 | /// <returns></returns> | ||
573 | protected string HandleClientStatsReport(string[] showParams) | ||
574 | { | ||
575 | // NOTE: This writes to m_log on purpose. We want to store this information | ||
576 | // in case we need to analyze it later. | ||
577 | // | ||
578 | if (showParams.Length <= 4) | ||
579 | { | ||
580 | m_log.InfoFormat("[INFO]: {0,-12} {1,-20} {2,-6} {3,-11} {4,-11} {5,-16}", "Region", "Name", "Root", "Time", "Reqs/min", "AgentUpdates"); | ||
581 | foreach (Scene scene in m_scenes.Values) | ||
582 | { | ||
583 | scene.ForEachClient( | ||
584 | delegate(IClientAPI client) | ||
585 | { | ||
586 | if (client is LLClientView) | ||
587 | { | ||
588 | LLClientView llClient = client as LLClientView; | ||
589 | ClientInfo cinfo = llClient.UDPClient.GetClientInfo(); | ||
590 | int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); | ||
591 | avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); | ||
592 | |||
593 | string childAgentStatus; | ||
594 | |||
595 | if (llClient.SceneAgent != null) | ||
596 | childAgentStatus = llClient.SceneAgent.IsChildAgent ? "N" : "Y"; | ||
597 | else | ||
598 | childAgentStatus = "Off!"; | ||
599 | |||
600 | m_log.InfoFormat("[INFO]: {0,-12} {1,-20} {2,-6} {3,-11} {4,-11} {5,-16}", | ||
601 | scene.RegionInfo.RegionName, llClient.Name, | ||
602 | childAgentStatus, | ||
603 | (DateTime.Now - cinfo.StartedTime).Minutes, | ||
604 | avg_reqs, | ||
605 | string.Format( | ||
606 | "{0} ({1:0.00}%)", | ||
607 | llClient.TotalAgentUpdates, | ||
608 | cinfo.SyncRequests.ContainsKey("AgentUpdate") | ||
609 | ? (float)cinfo.SyncRequests["AgentUpdate"] / llClient.TotalAgentUpdates * 100 | ||
610 | : 0)); | ||
611 | } | ||
612 | }); | ||
613 | } | ||
614 | return string.Empty; | ||
615 | } | ||
616 | |||
617 | string fname = "", lname = ""; | ||
618 | |||
619 | if (showParams.Length > 3) | ||
620 | fname = showParams[3]; | ||
621 | if (showParams.Length > 4) | ||
622 | lname = showParams[4]; | ||
623 | |||
624 | foreach (Scene scene in m_scenes.Values) | ||
625 | { | ||
626 | scene.ForEachClient( | ||
627 | delegate(IClientAPI client) | ||
628 | { | ||
629 | if (client is LLClientView) | ||
630 | { | ||
631 | LLClientView llClient = client as LLClientView; | ||
632 | |||
633 | if (llClient.Name == fname + " " + lname) | ||
634 | { | ||
635 | |||
636 | ClientInfo cinfo = llClient.GetClientInfo(); | ||
637 | AgentCircuitData aCircuit = scene.AuthenticateHandler.GetAgentCircuitData(llClient.CircuitCode); | ||
638 | if (aCircuit == null) // create a dummy one | ||
639 | aCircuit = new AgentCircuitData(); | ||
640 | |||
641 | if (!llClient.SceneAgent.IsChildAgent) | ||
642 | m_log.InfoFormat("[INFO]: {0} # {1} # {2}", llClient.Name, Util.GetViewerName(aCircuit), aCircuit.Id0); | ||
643 | |||
644 | int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); | ||
645 | avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); | ||
646 | |||
647 | m_log.InfoFormat("[INFO]:"); | ||
648 | m_log.InfoFormat("[INFO]: {0} # {1} # Time: {2}min # Avg Reqs/min: {3}", scene.RegionInfo.RegionName, | ||
649 | (llClient.SceneAgent.IsChildAgent ? "Child" : "Root"), (DateTime.Now - cinfo.StartedTime).Minutes, avg_reqs); | ||
650 | |||
651 | Dictionary<string, int> sortedDict = (from entry in cinfo.AsyncRequests orderby entry.Value descending select entry) | ||
652 | .ToDictionary(pair => pair.Key, pair => pair.Value); | ||
653 | PrintRequests("TOP ASYNC", sortedDict, cinfo.AsyncRequests.Values.Sum()); | ||
654 | |||
655 | sortedDict = (from entry in cinfo.SyncRequests orderby entry.Value descending select entry) | ||
656 | .ToDictionary(pair => pair.Key, pair => pair.Value); | ||
657 | PrintRequests("TOP SYNC", sortedDict, cinfo.SyncRequests.Values.Sum()); | ||
658 | |||
659 | sortedDict = (from entry in cinfo.GenericRequests orderby entry.Value descending select entry) | ||
660 | .ToDictionary(pair => pair.Key, pair => pair.Value); | ||
661 | PrintRequests("TOP GENERIC", sortedDict, cinfo.GenericRequests.Values.Sum()); | ||
662 | } | ||
663 | } | ||
664 | }); | ||
665 | } | ||
666 | return string.Empty; | ||
667 | } | 532 | } |
668 | 533 | ||
669 | private void PrintRequests(string type, Dictionary<string, int> sortedDict, int sum) | 534 | private void PrintRequests(string type, Dictionary<string, int> sortedDict, int sum) |