diff options
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 101 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 22 |
2 files changed, 88 insertions, 35 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index f80cb34..c20a4e8 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -30,6 +30,7 @@ using System.Collections; | |||
30 | using System.Collections.Generic; | 30 | using System.Collections.Generic; |
31 | using System.IO; | 31 | using System.IO; |
32 | using System.Reflection; | 32 | using System.Reflection; |
33 | using System.Text; | ||
33 | using System.Timers; | 34 | using System.Timers; |
34 | using log4net; | 35 | using log4net; |
35 | using Nini.Config; | 36 | using Nini.Config; |
@@ -988,38 +989,74 @@ namespace OpenSim | |||
988 | /// <returns></returns> | 989 | /// <returns></returns> |
989 | private string GetQueuesReport() | 990 | private string GetQueuesReport() |
990 | { | 991 | { |
991 | string report = String.Empty; | 992 | StringBuilder report = new StringBuilder(); |
992 | 993 | ||
993 | m_sceneManager.ForEachScene(delegate(Scene scene) | 994 | int columnPadding = 2; |
994 | { | 995 | int maxNameLength = 18; |
995 | scene.ForEachClient(delegate(IClientAPI client) | 996 | int maxRegionNameLength = 14; |
996 | { | 997 | int maxTypeLength = 5; |
997 | if (client is IStatsCollector) | 998 | int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; |
998 | { | 999 | |
999 | report = report + client.FirstName + | 1000 | report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", ""); |
1000 | " " + client.LastName; | 1001 | report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", ""); |
1001 | 1002 | report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type", ""); | |
1002 | IStatsCollector stats = | 1003 | |
1003 | (IStatsCollector) client; | 1004 | report.AppendFormat( |
1004 | 1005 | "{0,9} {1,10} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7} {9,7}\n", | |
1005 | report = report + string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}\n", | 1006 | "Packets", |
1006 | "Send", | 1007 | "Packets", |
1007 | "In", | 1008 | "Bytes", |
1008 | "Out", | 1009 | "Bytes", |
1009 | "Resend", | 1010 | "Bytes", |
1010 | "Land", | 1011 | "Bytes", |
1011 | "Wind", | 1012 | "Bytes", |
1012 | "Cloud", | 1013 | "Bytes", |
1013 | "Task", | 1014 | "Bytes", |
1014 | "Texture", | 1015 | "Bytes"); |
1015 | "Asset"); | 1016 | |
1016 | report = report + stats.Report() + | 1017 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); |
1017 | "\n"; | 1018 | report.AppendFormat( |
1018 | } | 1019 | "{0,9} {1,10} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7} {9,7}\n", |
1019 | }); | 1020 | "Sent", |
1020 | }); | 1021 | "Received", |
1021 | 1022 | "Resend", | |
1022 | return report; | 1023 | "Land", |
1024 | "Wind", | ||
1025 | "Cloud", | ||
1026 | "Task", | ||
1027 | "Texture", | ||
1028 | "Asset", | ||
1029 | "State"); | ||
1030 | |||
1031 | m_sceneManager.ForEachScene( | ||
1032 | delegate(Scene scene) | ||
1033 | { | ||
1034 | scene.ForEachClient( | ||
1035 | delegate(IClientAPI client) | ||
1036 | { | ||
1037 | if (client is IStatsCollector) | ||
1038 | { | ||
1039 | string name = client.Name; | ||
1040 | string regionName = scene.RegionInfo.RegionName; | ||
1041 | |||
1042 | report.AppendFormat( | ||
1043 | "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", | ||
1044 | name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); | ||
1045 | report.AppendFormat( | ||
1046 | "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", | ||
1047 | regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, ""); | ||
1048 | report.AppendFormat( | ||
1049 | "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", | ||
1050 | scene.PresenceChildStatus(client.AgentId) ? "Child" : "Root", ""); | ||
1051 | |||
1052 | IStatsCollector stats = (IStatsCollector)client; | ||
1053 | |||
1054 | report.AppendLine(stats.Report()); | ||
1055 | } | ||
1056 | }); | ||
1057 | }); | ||
1058 | |||
1059 | return report.ToString(); | ||
1023 | } | 1060 | } |
1024 | 1061 | ||
1025 | /// <summary> | 1062 | /// <summary> |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index ca5a7bd..1812c08 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -246,11 +246,27 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
246 | throw new NotImplementedException(); | 246 | throw new NotImplementedException(); |
247 | } | 247 | } |
248 | 248 | ||
249 | /// <summary> | ||
250 | /// Return statistics information about client packet queues. | ||
251 | /// </summary> | ||
252 | /// | ||
253 | /// FIXME: This should really be done in a more sensible manner rather than sending back a formatted string. | ||
254 | /// | ||
255 | /// <returns></returns> | ||
249 | public string GetStats() | 256 | public string GetStats() |
250 | { | 257 | { |
251 | // TODO: ??? | 258 | return string.Format( |
252 | return string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", | 259 | "{0,9} {1,10} {2,8} {3,7} {4,7} {5,7} {6,7} {7,9} {8,7} {9,7}", |
253 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); | 260 | PacketsSent, |
261 | PacketsReceived, | ||
262 | m_throttleCategories[(int)ThrottleOutPacketType.Resend].Content, | ||
263 | m_throttleCategories[(int)ThrottleOutPacketType.Land].Content, | ||
264 | m_throttleCategories[(int)ThrottleOutPacketType.Wind].Content, | ||
265 | m_throttleCategories[(int)ThrottleOutPacketType.Cloud].Content, | ||
266 | m_throttleCategories[(int)ThrottleOutPacketType.Task].Content, | ||
267 | m_throttleCategories[(int)ThrottleOutPacketType.Texture].Content, | ||
268 | m_throttleCategories[(int)ThrottleOutPacketType.Asset].Content, | ||
269 | m_throttleCategories[(int)ThrottleOutPacketType.State].Content); | ||
254 | } | 270 | } |
255 | 271 | ||
256 | public void SendPacketStats() | 272 | public void SendPacketStats() |