diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Agent')
3 files changed, 177 insertions, 81 deletions
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 781539a..6fe86b2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs | |||
@@ -71,7 +71,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
71 | m_client = client; | 71 | m_client = client; |
72 | m_scene = scene; | 72 | m_scene = scene; |
73 | 73 | ||
74 | Watchdog.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); | 74 | WorkManager.StartThread(InternalLoop, "IRCClientView", ThreadPriority.Normal, false, true); |
75 | } | 75 | } |
76 | 76 | ||
77 | private void SendServerCommand(string command) | 77 | private void SendServerCommand(string command) |
@@ -516,7 +516,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
516 | 516 | ||
517 | public Vector3 StartPos | 517 | public Vector3 StartPos |
518 | { | 518 | { |
519 | get { return new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 50); } | 519 | get { return new Vector3(m_scene.RegionInfo.RegionSizeX * 0.5f, m_scene.RegionInfo.RegionSizeY * 0.5f, 50f); } |
520 | set { } | 520 | set { } |
521 | } | 521 | } |
522 | 522 | ||
@@ -660,6 +660,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
660 | public event BakeTerrain OnBakeTerrain; | 660 | public event BakeTerrain OnBakeTerrain; |
661 | public event EstateChangeInfo OnEstateChangeInfo; | 661 | public event EstateChangeInfo OnEstateChangeInfo; |
662 | public event EstateManageTelehub OnEstateManageTelehub; | 662 | public event EstateManageTelehub OnEstateManageTelehub; |
663 | public event CachedTextureRequest OnCachedTextureRequest; | ||
663 | public event SetAppearance OnSetAppearance; | 664 | public event SetAppearance OnSetAppearance; |
664 | public event AvatarNowWearing OnAvatarNowWearing; | 665 | public event AvatarNowWearing OnAvatarNowWearing; |
665 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; | 666 | public event RezSingleAttachmentFromInv OnRezSingleAttachmentFromInv; |
@@ -686,6 +687,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
686 | public event Action<IClientAPI, bool> OnCompleteMovementToRegion; | 687 | public event Action<IClientAPI, bool> OnCompleteMovementToRegion; |
687 | public event UpdateAgent OnPreAgentUpdate; | 688 | public event UpdateAgent OnPreAgentUpdate; |
688 | public event UpdateAgent OnAgentUpdate; | 689 | public event UpdateAgent OnAgentUpdate; |
690 | public event UpdateAgent OnAgentCameraUpdate; | ||
689 | public event AgentRequestSit OnAgentRequestSit; | 691 | public event AgentRequestSit OnAgentRequestSit; |
690 | public event AgentSit OnAgentSit; | 692 | public event AgentSit OnAgentSit; |
691 | public event AvatarPickerRequest OnAvatarPickerRequest; | 693 | public event AvatarPickerRequest OnAvatarPickerRequest; |
@@ -901,12 +903,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
901 | 903 | ||
902 | public void Start() | 904 | public void Start() |
903 | { | 905 | { |
904 | m_scene.AddNewClient(this, PresenceType.User); | 906 | m_scene.AddNewAgent(this, PresenceType.User); |
905 | 907 | ||
906 | // Mimicking LLClientView which gets always set appearance from client. | 908 | // Mimicking LLClientView which gets always set appearance from client. |
907 | AvatarAppearance appearance; | 909 | AvatarAppearance appearance; |
908 | m_scene.GetAvatarAppearance(this, out appearance); | 910 | m_scene.GetAvatarAppearance(this, out appearance); |
909 | OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone()); | 911 | OnSetAppearance(this, appearance.Texture, (byte[])appearance.VisualParams.Clone(),appearance.AvatarSize, new WearableCacheItem[0]); |
910 | } | 912 | } |
911 | 913 | ||
912 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) | 914 | public void SendRegionHandshake(RegionInfo regionInfo, RegionHandshakeArgs args) |
@@ -938,13 +940,18 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
938 | { | 940 | { |
939 | 941 | ||
940 | } | 942 | } |
943 | |||
944 | public void SendCachedTextureResponse(ISceneEntity avatar, int serial, List<CachedTextureResponseArg> cachedTextures) | ||
945 | { | ||
941 | 946 | ||
947 | } | ||
948 | |||
942 | public void SendStartPingCheck(byte seq) | 949 | public void SendStartPingCheck(byte seq) |
943 | { | 950 | { |
944 | 951 | ||
945 | } | 952 | } |
946 | 953 | ||
947 | public void SendKillObject(ulong regionHandle, List<uint> localID) | 954 | public void SendKillObject(List<uint> localID) |
948 | { | 955 | { |
949 | 956 | ||
950 | } | 957 | } |
@@ -971,12 +978,12 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
971 | // TODO | 978 | // TODO |
972 | } | 979 | } |
973 | 980 | ||
974 | public void SendGenericMessage(string method, List<string> message) | 981 | public void SendGenericMessage(string method, UUID invoice, List<string> message) |
975 | { | 982 | { |
976 | 983 | ||
977 | } | 984 | } |
978 | 985 | ||
979 | public void SendGenericMessage(string method, List<byte[]> message) | 986 | public void SendGenericMessage(string method, UUID invoice, List<byte[]> message) |
980 | { | 987 | { |
981 | 988 | ||
982 | } | 989 | } |
@@ -1050,7 +1057,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1050 | { | 1057 | { |
1051 | } | 1058 | } |
1052 | 1059 | ||
1053 | public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance) | 1060 | public void SendMoneyBalance(UUID transaction, bool success, byte[] description, int balance, int transactionType, UUID sourceID, bool sourceIsGroup, UUID destID, bool destIsGroup, int amount, string item) |
1054 | { | 1061 | { |
1055 | 1062 | ||
1056 | } | 1063 | } |
@@ -1190,11 +1197,6 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1190 | 1197 | ||
1191 | } | 1198 | } |
1192 | 1199 | ||
1193 | public bool AddMoney(int debit) | ||
1194 | { | ||
1195 | return true; | ||
1196 | } | ||
1197 | |||
1198 | public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition) | 1200 | public void SendSunPos(Vector3 sunPos, Vector3 sunVel, ulong CurrentTime, uint SecondsPerSunCycle, uint SecondsPerYear, float OrbitalPosition) |
1199 | { | 1201 | { |
1200 | 1202 | ||
@@ -1424,9 +1426,11 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1424 | return new byte[0]; | 1426 | return new byte[0]; |
1425 | } | 1427 | } |
1426 | 1428 | ||
1429 | #pragma warning disable 0067 | ||
1427 | public event ViewerEffectEventHandler OnViewerEffect; | 1430 | public event ViewerEffectEventHandler OnViewerEffect; |
1428 | public event Action<IClientAPI> OnLogout; | 1431 | public event Action<IClientAPI> OnLogout; |
1429 | public event Action<IClientAPI> OnConnectionClosed; | 1432 | public event Action<IClientAPI> OnConnectionClosed; |
1433 | #pragma warning restore 0067 | ||
1430 | 1434 | ||
1431 | public void SendBlueBoxMessage(UUID FromAvatarID, string FromAvatarName, string Message) | 1435 | public void SendBlueBoxMessage(UUID FromAvatarID, string FromAvatarName, string Message) |
1432 | { | 1436 | { |
@@ -1671,12 +1675,17 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
1671 | { | 1675 | { |
1672 | } | 1676 | } |
1673 | 1677 | ||
1674 | public void StopFlying(ISceneEntity presence) | 1678 | public void SendAgentTerseUpdate(ISceneEntity presence) |
1675 | { | 1679 | { |
1676 | } | 1680 | } |
1677 | 1681 | ||
1678 | public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) | 1682 | public void SendPlacesReply(UUID queryID, UUID transactionID, PlacesReplyData[] data) |
1679 | { | 1683 | { |
1680 | } | 1684 | } |
1685 | |||
1686 | public void SendPartPhysicsProprieties(ISceneEntity entity) | ||
1687 | { | ||
1688 | } | ||
1689 | |||
1681 | } | 1690 | } |
1682 | } | 1691 | } |
diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs index 9d27386..a1682d2 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCServer.cs | |||
@@ -58,7 +58,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server | |||
58 | 58 | ||
59 | m_listener.Start(50); | 59 | m_listener.Start(50); |
60 | 60 | ||
61 | Watchdog.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); | 61 | WorkManager.StartThread(ListenLoop, "IRCServer", ThreadPriority.Normal, false, true); |
62 | m_baseScene = baseScene; | 62 | m_baseScene = baseScene; |
63 | } | 63 | } |
64 | 64 | ||
diff --git a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs index 992f38e..08d0fbf 100644 --- a/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs +++ b/OpenSim/Region/OptionalModules/Agent/UDP/Linden/LindenUDPInfoModule.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Linq; | ||
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Text; | 32 | using System.Text; |
32 | using log4net; | 33 | using log4net; |
@@ -51,7 +52,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
51 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] | 52 | [Extension(Path = "/OpenSim/RegionModules", NodeName = "RegionModule", Id = "LindenUDPInfoModule")] |
52 | public class LindenUDPInfoModule : ISharedRegionModule | 53 | public class LindenUDPInfoModule : ISharedRegionModule |
53 | { | 54 | { |
54 | // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 55 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
55 | 56 | ||
56 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); | 57 | protected Dictionary<UUID, Scene> m_scenes = new Dictionary<UUID, Scene>(); |
57 | 58 | ||
@@ -130,6 +131,15 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
130 | "Go on/off emergency monitoring mode", | 131 | "Go on/off emergency monitoring mode", |
131 | "Go on/off emergency monitoring mode", | 132 | "Go on/off emergency monitoring mode", |
132 | HandleEmergencyMonitoring); | 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 | |||
133 | } | 143 | } |
134 | 144 | ||
135 | public void RemoveRegion(Scene scene) | 145 | public void RemoveRegion(Scene scene) |
@@ -294,7 +304,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
294 | private string GetImageQueuesReport(string[] showParams) | 304 | private string GetImageQueuesReport(string[] showParams) |
295 | { | 305 | { |
296 | if (showParams.Length < 5 || showParams.Length > 6) | 306 | if (showParams.Length < 5 || showParams.Length > 6) |
297 | return "Usage: image queues show <first-name> <last-name> [full]"; | 307 | return "Usage: show image queues <first-name> <last-name> [full]"; |
298 | 308 | ||
299 | string firstName = showParams[3]; | 309 | string firstName = showParams[3]; |
300 | string lastName = showParams[4]; | 310 | string lastName = showParams[4]; |
@@ -385,7 +395,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
385 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); | 395 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); |
386 | 396 | ||
387 | report.AppendFormat( | 397 | report.AppendFormat( |
388 | "{0,7} {1,7} {2,7} {3,7} {4,9} {5,7} {6,7} {7,7} {8,7} {9,7} {10,8} {11,7} {12,7}\n", | 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", |
389 | "Since", | 399 | "Since", |
390 | "Pkts", | 400 | "Pkts", |
391 | "Pkts", | 401 | "Pkts", |
@@ -397,12 +407,11 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
397 | "Q Pkts", | 407 | "Q Pkts", |
398 | "Q Pkts", | 408 | "Q Pkts", |
399 | "Q Pkts", | 409 | "Q Pkts", |
400 | "Q Pkts", | ||
401 | "Q Pkts"); | 410 | "Q Pkts"); |
402 | 411 | ||
403 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); | 412 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); |
404 | report.AppendFormat( | 413 | report.AppendFormat( |
405 | "{0,7} {1,7} {2,7} {3,7} {4,9} {5,7} {6,7} {7,7} {8,7} {9,7} {10,8} {11,7} {12,7}\n", | 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", |
406 | "Last In", | 415 | "Last In", |
407 | "In", | 416 | "In", |
408 | "Out", | 417 | "Out", |
@@ -414,8 +423,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
414 | "Cloud", | 423 | "Cloud", |
415 | "Task", | 424 | "Task", |
416 | "Texture", | 425 | "Texture", |
417 | "Asset", | 426 | "Asset"); |
418 | "State"); | ||
419 | 427 | ||
420 | lock (m_scenes) | 428 | lock (m_scenes) |
421 | { | 429 | { |
@@ -424,24 +432,24 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
424 | scene.ForEachClient( | 432 | scene.ForEachClient( |
425 | delegate(IClientAPI client) | 433 | delegate(IClientAPI client) |
426 | { | 434 | { |
427 | bool isChild = client.SceneAgent.IsChildAgent; | ||
428 | if (isChild && !showChildren) | ||
429 | return; | ||
430 | |||
431 | string name = client.Name; | ||
432 | if (pname != "" && name != pname) | ||
433 | return; | ||
434 | |||
435 | string regionName = scene.RegionInfo.RegionName; | ||
436 | |||
437 | report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); | ||
438 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); | ||
439 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); | ||
440 | |||
441 | if (client is IStatsCollector) | 435 | if (client is IStatsCollector) |
442 | { | 436 | { |
443 | IStatsCollector stats = (IStatsCollector)client; | 437 | |
438 | bool isChild = client.SceneAgent.IsChildAgent; | ||
439 | if (isChild && !showChildren) | ||
440 | return; | ||
444 | 441 | ||
442 | string name = client.Name; | ||
443 | if (pname != "" && name != pname) | ||
444 | return; | ||
445 | |||
446 | string regionName = scene.RegionInfo.RegionName; | ||
447 | |||
448 | report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); | ||
449 | report.Append(GetColumnEntry(regionName, maxRegionNameLength, columnPadding)); | ||
450 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); | ||
451 | |||
452 | IStatsCollector stats = (IStatsCollector)client; | ||
445 | report.AppendLine(stats.Report()); | 453 | report.AppendLine(stats.Report()); |
446 | } | 454 | } |
447 | }); | 455 | }); |
@@ -479,8 +487,10 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
479 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); | 487 | report.Append(GetColumnEntry("Type", maxTypeLength, columnPadding)); |
480 | 488 | ||
481 | report.AppendFormat( | 489 | report.AppendFormat( |
482 | "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}\n", | 490 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", |
483 | "Total", | 491 | "Max", |
492 | "Target", | ||
493 | "Actual", | ||
484 | "Resend", | 494 | "Resend", |
485 | "Land", | 495 | "Land", |
486 | "Wind", | 496 | "Wind", |
@@ -491,7 +501,9 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
491 | 501 | ||
492 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); | 502 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); |
493 | report.AppendFormat( | 503 | report.AppendFormat( |
494 | "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", | 504 | "{0,8} {1,8} {2,7} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7}\n", |
505 | "kb/s", | ||
506 | "kb/s", | ||
495 | "kb/s", | 507 | "kb/s", |
496 | "kb/s", | 508 | "kb/s", |
497 | "kb/s", | 509 | "kb/s", |
@@ -503,8 +515,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
503 | 515 | ||
504 | report.AppendLine(); | 516 | report.AppendLine(); |
505 | 517 | ||
506 | bool firstClient = true; | ||
507 | |||
508 | lock (m_scenes) | 518 | lock (m_scenes) |
509 | { | 519 | { |
510 | foreach (Scene scene in m_scenes.Values) | 520 | foreach (Scene scene in m_scenes.Values) |
@@ -516,12 +526,6 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
516 | { | 526 | { |
517 | LLClientView llClient = client as LLClientView; | 527 | LLClientView llClient = client as LLClientView; |
518 | 528 | ||
519 | if (firstClient) | ||
520 | { | ||
521 | report.AppendLine(GetServerThrottlesReport(llClient.UDPServer)); | ||
522 | firstClient = false; | ||
523 | } | ||
524 | |||
525 | bool isChild = client.SceneAgent.IsChildAgent; | 529 | bool isChild = client.SceneAgent.IsChildAgent; |
526 | if (isChild && !showChildren) | 530 | if (isChild && !showChildren) |
527 | return; | 531 | return; |
@@ -540,7 +544,11 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
540 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); | 544 | report.Append(GetColumnEntry(isChild ? "Cd" : "Rt", maxTypeLength, columnPadding)); |
541 | 545 | ||
542 | report.AppendFormat( | 546 | report.AppendFormat( |
543 | "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", | 547 | "{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() : "-", | ||
549 | llUdpClient.FlowThrottle.AdaptiveEnabled | ||
550 | ? ((ci.targetThrottle * 8) / 1000).ToString() | ||
551 | : (llUdpClient.FlowThrottle.TotalDripRequest * 8 / 1000).ToString(), | ||
544 | (ci.totalThrottle * 8) / 1000, | 552 | (ci.totalThrottle * 8) / 1000, |
545 | (ci.resendThrottle * 8) / 1000, | 553 | (ci.resendThrottle * 8) / 1000, |
546 | (ci.landThrottle * 8) / 1000, | 554 | (ci.landThrottle * 8) / 1000, |
@@ -548,9 +556,7 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
548 | (ci.cloudThrottle * 8) / 1000, | 556 | (ci.cloudThrottle * 8) / 1000, |
549 | (ci.taskThrottle * 8) / 1000, | 557 | (ci.taskThrottle * 8) / 1000, |
550 | (ci.textureThrottle * 8) / 1000, | 558 | (ci.textureThrottle * 8) / 1000, |
551 | (ci.assetThrottle * 8) / 1000); | 559 | (ci.assetThrottle * 8) / 1000); |
552 | |||
553 | report.AppendLine(); | ||
554 | } | 560 | } |
555 | }); | 561 | }); |
556 | } | 562 | } |
@@ -558,35 +564,116 @@ namespace OpenSim.Region.OptionalModules.UDP.Linden | |||
558 | 564 | ||
559 | return report.ToString(); | 565 | return report.ToString(); |
560 | } | 566 | } |
561 | 567 | ||
562 | protected string GetServerThrottlesReport(LLUDPServer udpServer) | 568 | /// <summary> |
569 | /// Show client stats data | ||
570 | /// </summary> | ||
571 | /// <param name="showParams"></param> | ||
572 | /// <returns></returns> | ||
573 | protected string HandleClientStatsReport(string[] showParams) | ||
563 | { | 574 | { |
564 | StringBuilder report = new StringBuilder(); | 575 | // NOTE: This writes to m_log on purpose. We want to store this information |
565 | 576 | // in case we need to analyze it later. | |
566 | int columnPadding = 2; | 577 | // |
567 | int maxNameLength = 18; | 578 | if (showParams.Length <= 4) |
568 | int maxRegionNameLength = 14; | 579 | { |
569 | int maxTypeLength = 4; | 580 | m_log.InfoFormat("[INFO]: {0,-12} {1,-20} {2,-6} {3,-11} {4,-11} {5,-16}", "Region", "Name", "Root", "Time", "Reqs/min", "AgentUpdates"); |
570 | 581 | foreach (Scene scene in m_scenes.Values) | |
571 | string name = "SERVER AGENT RATES"; | 582 | { |
572 | 583 | scene.ForEachClient( | |
573 | report.Append(GetColumnEntry(name, maxNameLength, columnPadding)); | 584 | delegate(IClientAPI client) |
574 | report.Append(GetColumnEntry("-", maxRegionNameLength, columnPadding)); | 585 | { |
575 | report.Append(GetColumnEntry("-", maxTypeLength, columnPadding)); | 586 | if (client is LLClientView) |
576 | 587 | { | |
577 | ThrottleRates throttleRates = udpServer.ThrottleRates; | 588 | LLClientView llClient = client as LLClientView; |
578 | report.AppendFormat( | 589 | ClientInfo cinfo = llClient.UDPClient.GetClientInfo(); |
579 | "{0,7} {1,8} {2,7} {3,7} {4,7} {5,7} {6,9} {7,7}", | 590 | int avg_reqs = cinfo.AsyncRequests.Values.Sum() + cinfo.GenericRequests.Values.Sum() + cinfo.SyncRequests.Values.Sum(); |
580 | (throttleRates.Total * 8) / 1000, | 591 | avg_reqs = avg_reqs / ((DateTime.Now - cinfo.StartedTime).Minutes + 1); |
581 | (throttleRates.Resend * 8) / 1000, | 592 | |
582 | (throttleRates.Land * 8) / 1000, | 593 | string childAgentStatus; |
583 | (throttleRates.Wind * 8) / 1000, | 594 | |
584 | (throttleRates.Cloud * 8) / 1000, | 595 | if (llClient.SceneAgent != null) |
585 | (throttleRates.Task * 8) / 1000, | 596 | childAgentStatus = llClient.SceneAgent.IsChildAgent ? "N" : "Y"; |
586 | (throttleRates.Texture * 8) / 1000, | 597 | else |
587 | (throttleRates.Asset * 8) / 1000); | 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 | } | ||
588 | 616 | ||
589 | return report.ToString(); | 617 | string fname = "", lname = ""; |
590 | } | 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 | } | ||
668 | |||
669 | private void PrintRequests(string type, Dictionary<string, int> sortedDict, int sum) | ||
670 | { | ||
671 | m_log.InfoFormat("[INFO]:"); | ||
672 | m_log.InfoFormat("[INFO]: {0,25}", type); | ||
673 | foreach (KeyValuePair<string, int> kvp in sortedDict.Take(12)) | ||
674 | m_log.InfoFormat("[INFO]: {0,25} {1,-6}", kvp.Key, kvp.Value); | ||
675 | m_log.InfoFormat("[INFO]: {0,25}", "..."); | ||
676 | m_log.InfoFormat("[INFO]: {0,25} {1,-6}", "Total", sum); | ||
677 | } | ||
591 | } | 678 | } |
592 | } \ No newline at end of file | 679 | } |