diff options
Diffstat (limited to 'OpenSim/Region/CoreModules/Framework/Caps')
-rw-r--r-- | OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | 92 |
1 files changed, 73 insertions, 19 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs index 6ce6227..0c759df 100644 --- a/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Caps/CapabilitiesModule.cs | |||
@@ -80,7 +80,7 @@ namespace OpenSim.Region.CoreModules.Framework | |||
80 | 80 | ||
81 | MainConsole.Instance.Commands.AddCommand( | 81 | MainConsole.Instance.Commands.AddCommand( |
82 | "Comms", false, "show caps stats by user", | 82 | "Comms", false, "show caps stats by user", |
83 | "show caps stats [<first-name> <last-name>]", | 83 | "show caps stats by user [<first-name> <last-name>]", |
84 | "Shows statistics on capabilities use by user.", | 84 | "Shows statistics on capabilities use by user.", |
85 | "If a user name is given, then prints a detailed breakdown of caps use ordered by number of requests received.", | 85 | "If a user name is given, then prints a detailed breakdown of caps use ordered by number of requests received.", |
86 | HandleShowCapsStatsByUserCommand); | 86 | HandleShowCapsStatsByUserCommand); |
@@ -296,27 +296,31 @@ namespace OpenSim.Region.CoreModules.Framework | |||
296 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) | 296 | if (SceneManager.Instance.CurrentScene != null && SceneManager.Instance.CurrentScene != m_scene) |
297 | return; | 297 | return; |
298 | 298 | ||
299 | StringBuilder caps = new StringBuilder(); | 299 | StringBuilder capsReport = new StringBuilder(); |
300 | caps.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); | 300 | capsReport.AppendFormat("Region {0}:\n", m_scene.RegionInfo.RegionName); |
301 | 301 | ||
302 | lock (m_capsObjects) | 302 | lock (m_capsObjects) |
303 | { | 303 | { |
304 | foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects) | 304 | foreach (KeyValuePair<uint, Caps> kvp in m_capsObjects) |
305 | { | 305 | { |
306 | caps.AppendFormat("** Circuit {0}:\n", kvp.Key); | 306 | capsReport.AppendFormat("** Circuit {0}:\n", kvp.Key); |
307 | Caps caps = kvp.Value; | ||
307 | 308 | ||
308 | for (IDictionaryEnumerator kvp2 = kvp.Value.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); ) | 309 | for (IDictionaryEnumerator kvp2 = caps.CapsHandlers.GetCapsDetails(false, null).GetEnumerator(); kvp2.MoveNext(); ) |
309 | { | 310 | { |
310 | Uri uri = new Uri(kvp2.Value.ToString()); | 311 | Uri uri = new Uri(kvp2.Value.ToString()); |
311 | caps.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery); | 312 | capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, uri.PathAndQuery); |
312 | } | 313 | } |
313 | 314 | ||
314 | foreach (KeyValuePair<string, string> kvp3 in kvp.Value.ExternalCapsHandlers) | 315 | foreach (KeyValuePair<string, PollServiceEventArgs> kvp2 in caps.GetPollHandlers()) |
315 | caps.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value); | 316 | capsReport.AppendFormat(m_showCapsCommandFormat, kvp2.Key, kvp2.Value.Url); |
317 | |||
318 | foreach (KeyValuePair<string, string> kvp3 in caps.ExternalCapsHandlers) | ||
319 | capsReport.AppendFormat(m_showCapsCommandFormat, kvp3.Key, kvp3.Value); | ||
316 | } | 320 | } |
317 | } | 321 | } |
318 | 322 | ||
319 | MainConsole.Instance.Output(caps.ToString()); | 323 | MainConsole.Instance.Output(capsReport.ToString()); |
320 | } | 324 | } |
321 | 325 | ||
322 | private void HandleShowCapsStatsByCapCommand(string module, string[] cmdParams) | 326 | private void HandleShowCapsStatsByCapCommand(string module, string[] cmdParams) |
@@ -374,7 +378,16 @@ namespace OpenSim.Region.CoreModules.Framework | |||
374 | { | 378 | { |
375 | receivedStats[sp.Name] = reqHandler.RequestsReceived; | 379 | receivedStats[sp.Name] = reqHandler.RequestsReceived; |
376 | handledStats[sp.Name] = reqHandler.RequestsHandled; | 380 | handledStats[sp.Name] = reqHandler.RequestsHandled; |
377 | } | 381 | } |
382 | else | ||
383 | { | ||
384 | PollServiceEventArgs pollHandler = null; | ||
385 | if (caps.TryGetPollHandler(capName, out pollHandler)) | ||
386 | { | ||
387 | receivedStats[sp.Name] = pollHandler.RequestsReceived; | ||
388 | handledStats[sp.Name] = pollHandler.RequestsHandled; | ||
389 | } | ||
390 | } | ||
378 | } | 391 | } |
379 | ); | 392 | ); |
380 | 393 | ||
@@ -405,11 +418,9 @@ namespace OpenSim.Region.CoreModules.Framework | |||
405 | Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID); | 418 | Caps caps = m_scene.CapsModule.GetCapsForUser(sp.UUID); |
406 | 419 | ||
407 | if (caps == null) | 420 | if (caps == null) |
408 | return; | 421 | return; |
409 | |||
410 | Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers(); | ||
411 | 422 | ||
412 | foreach (IRequestHandler reqHandler in capsHandlers.Values) | 423 | foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values) |
413 | { | 424 | { |
414 | string reqName = reqHandler.Name ?? ""; | 425 | string reqName = reqHandler.Name ?? ""; |
415 | 426 | ||
@@ -424,6 +435,23 @@ namespace OpenSim.Region.CoreModules.Framework | |||
424 | handledStats[reqName] += reqHandler.RequestsHandled; | 435 | handledStats[reqName] += reqHandler.RequestsHandled; |
425 | } | 436 | } |
426 | } | 437 | } |
438 | |||
439 | foreach (KeyValuePair<string, PollServiceEventArgs> kvp in caps.GetPollHandlers()) | ||
440 | { | ||
441 | string name = kvp.Key; | ||
442 | PollServiceEventArgs pollHandler = kvp.Value; | ||
443 | |||
444 | if (!receivedStats.ContainsKey(name)) | ||
445 | { | ||
446 | receivedStats[name] = pollHandler.RequestsReceived; | ||
447 | handledStats[name] = pollHandler.RequestsHandled; | ||
448 | } | ||
449 | else | ||
450 | { | ||
451 | receivedStats[name] += pollHandler.RequestsReceived; | ||
452 | handledStats[name] += pollHandler.RequestsHandled; | ||
453 | } | ||
454 | } | ||
427 | } | 455 | } |
428 | ); | 456 | ); |
429 | 457 | ||
@@ -486,12 +514,16 @@ namespace OpenSim.Region.CoreModules.Framework | |||
486 | if (caps == null) | 514 | if (caps == null) |
487 | return; | 515 | return; |
488 | 516 | ||
489 | Dictionary<string, IRequestHandler> capsHandlers = caps.CapsHandlers.GetCapsHandlers(); | 517 | List<CapTableRow> capRows = new List<CapTableRow>(); |
490 | 518 | ||
491 | foreach (IRequestHandler reqHandler in capsHandlers.Values.OrderByDescending(rh => rh.RequestsReceived)) | 519 | foreach (IRequestHandler reqHandler in caps.CapsHandlers.GetCapsHandlers().Values) |
492 | { | 520 | capRows.Add(new CapTableRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled)); |
493 | cdt.AddRow(reqHandler.Name, reqHandler.RequestsReceived, reqHandler.RequestsHandled); | 521 | |
494 | } | 522 | foreach (KeyValuePair<string, PollServiceEventArgs> kvp in caps.GetPollHandlers()) |
523 | capRows.Add(new CapTableRow(kvp.Key, kvp.Value.RequestsReceived, kvp.Value.RequestsHandled)); | ||
524 | |||
525 | foreach (CapTableRow ctr in capRows.OrderByDescending(ctr => ctr.RequestsReceived)) | ||
526 | cdt.AddRow(ctr.Name, ctr.RequestsReceived, ctr.RequestsHandled); | ||
495 | 527 | ||
496 | sb.Append(cdt.ToString()); | 528 | sb.Append(cdt.ToString()); |
497 | */ | 529 | */ |
@@ -525,6 +557,14 @@ namespace OpenSim.Region.CoreModules.Framework | |||
525 | totalRequestsReceived += reqHandler.RequestsReceived; | 557 | totalRequestsReceived += reqHandler.RequestsReceived; |
526 | totalRequestsHandled += reqHandler.RequestsHandled; | 558 | totalRequestsHandled += reqHandler.RequestsHandled; |
527 | } | 559 | } |
560 | |||
561 | Dictionary<string, PollServiceEventArgs> capsPollHandlers = caps.GetPollHandlers(); | ||
562 | |||
563 | foreach (PollServiceEventArgs handler in capsPollHandlers.Values) | ||
564 | { | ||
565 | totalRequestsReceived += handler.RequestsReceived; | ||
566 | totalRequestsHandled += handler.RequestsHandled; | ||
567 | } | ||
528 | 568 | ||
529 | cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled); | 569 | cdt.AddRow(sp.Name, sp.IsChildAgent ? "child" : "root", totalRequestsReceived, totalRequestsHandled); |
530 | } | 570 | } |
@@ -533,5 +573,19 @@ namespace OpenSim.Region.CoreModules.Framework | |||
533 | sb.Append(cdt.ToString()); | 573 | sb.Append(cdt.ToString()); |
534 | */ | 574 | */ |
535 | } | 575 | } |
576 | |||
577 | private class CapTableRow | ||
578 | { | ||
579 | public string Name { get; set; } | ||
580 | public int RequestsReceived { get; set; } | ||
581 | public int RequestsHandled { get; set; } | ||
582 | |||
583 | public CapTableRow(string name, int requestsReceived, int requestsHandled) | ||
584 | { | ||
585 | Name = name; | ||
586 | RequestsReceived = requestsReceived; | ||
587 | RequestsHandled = requestsHandled; | ||
588 | } | ||
589 | } | ||
536 | } | 590 | } |
537 | } | 591 | } |