diff options
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 143 |
1 files changed, 98 insertions, 45 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index f80cb34..6127c2d 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; |
@@ -264,9 +265,10 @@ namespace OpenSim | |||
264 | LoadOar); | 265 | LoadOar); |
265 | 266 | ||
266 | m_console.Commands.AddCommand("region", false, "save oar", | 267 | m_console.Commands.AddCommand("region", false, "save oar", |
267 | "save oar [-v|version=N] [<OAR path>]", | 268 | "save oar [-v|--version=N] [-p|--profile=url] [<OAR path>]", |
268 | "Save a region's data to an OAR archive.", | 269 | "Save a region's data to an OAR archive.", |
269 | "-v|version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine | 270 | "-v|--version=N generates scene objects as per older versions of the serialization (e.g. -v=0)" + Environment.NewLine |
271 | + "-p|--profile=url adds the url of the profile service to the saved user information" + Environment.NewLine | ||
270 | + "The OAR path must be a filesystem path." | 272 | + "The OAR path must be a filesystem path." |
271 | + " If this is not given then the oar is saved to region.oar in the current directory.", | 273 | + " If this is not given then the oar is saved to region.oar in the current directory.", |
272 | SaveOar); | 274 | SaveOar); |
@@ -285,16 +287,15 @@ namespace OpenSim | |||
285 | 287 | ||
286 | m_console.Commands.AddCommand("region", false, "show users", | 288 | m_console.Commands.AddCommand("region", false, "show users", |
287 | "show users [full]", | 289 | "show users [full]", |
288 | "Show user data", HandleShow); | 290 | "Show user data for users currently on the region", |
291 | "Without the 'full' option, only users actually on the region are shown." | ||
292 | + " With the 'full' option child agents of users in neighbouring regions are also shown.", | ||
293 | HandleShow); | ||
289 | 294 | ||
290 | m_console.Commands.AddCommand("region", false, "show connections", | 295 | m_console.Commands.AddCommand("region", false, "show connections", |
291 | "show connections", | 296 | "show connections", |
292 | "Show connection data", HandleShow); | 297 | "Show connection data", HandleShow); |
293 | 298 | ||
294 | m_console.Commands.AddCommand("region", false, "show users full", | ||
295 | "show users full", | ||
296 | String.Empty, HandleShow); | ||
297 | |||
298 | m_console.Commands.AddCommand("region", false, "show modules", | 299 | m_console.Commands.AddCommand("region", false, "show modules", |
299 | "show modules", | 300 | "show modules", |
300 | "Show module data", HandleShow); | 301 | "Show module data", HandleShow); |
@@ -304,8 +305,12 @@ namespace OpenSim | |||
304 | "Show region data", HandleShow); | 305 | "Show region data", HandleShow); |
305 | 306 | ||
306 | m_console.Commands.AddCommand("region", false, "show queues", | 307 | m_console.Commands.AddCommand("region", false, "show queues", |
307 | "show queues", | 308 | "show queues [full]", |
308 | "Show queue data", HandleShow); | 309 | "Show queue data for each client", |
310 | "Without the 'full' option, only users actually on the region are shown." | ||
311 | + " With the 'full' option child agents of users in neighbouring regions are also shown.", | ||
312 | HandleShow); | ||
313 | |||
309 | m_console.Commands.AddCommand("region", false, "show ratings", | 314 | m_console.Commands.AddCommand("region", false, "show ratings", |
310 | "show ratings", | 315 | "show ratings", |
311 | "Show rating data", HandleShow); | 316 | "Show rating data", HandleShow); |
@@ -876,7 +881,7 @@ namespace OpenSim | |||
876 | { | 881 | { |
877 | agents = m_sceneManager.GetCurrentSceneAvatars(); | 882 | agents = m_sceneManager.GetCurrentSceneAvatars(); |
878 | } | 883 | } |
879 | 884 | ||
880 | MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); | 885 | MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); |
881 | 886 | ||
882 | MainConsole.Instance.Output( | 887 | MainConsole.Instance.Output( |
@@ -953,7 +958,7 @@ namespace OpenSim | |||
953 | break; | 958 | break; |
954 | 959 | ||
955 | case "queues": | 960 | case "queues": |
956 | Notice(GetQueuesReport()); | 961 | Notice(GetQueuesReport(showParams)); |
957 | break; | 962 | break; |
958 | 963 | ||
959 | case "ratings": | 964 | case "ratings": |
@@ -983,43 +988,91 @@ namespace OpenSim | |||
983 | } | 988 | } |
984 | 989 | ||
985 | /// <summary> | 990 | /// <summary> |
986 | /// print UDP Queue data for each client | 991 | /// Generate UDP Queue data report for each client |
987 | /// </summary> | 992 | /// </summary> |
993 | /// <param name="showParams"></param> | ||
988 | /// <returns></returns> | 994 | /// <returns></returns> |
989 | private string GetQueuesReport() | 995 | private string GetQueuesReport(string[] showParams) |
990 | { | 996 | { |
991 | string report = String.Empty; | 997 | bool showChildren = false; |
992 | 998 | ||
993 | m_sceneManager.ForEachScene(delegate(Scene scene) | 999 | if (showParams.Length > 1 && showParams[1] == "full") |
994 | { | 1000 | showChildren = true; |
995 | scene.ForEachClient(delegate(IClientAPI client) | 1001 | |
996 | { | 1002 | StringBuilder report = new StringBuilder(); |
997 | if (client is IStatsCollector) | 1003 | |
998 | { | 1004 | int columnPadding = 2; |
999 | report = report + client.FirstName + | 1005 | int maxNameLength = 18; |
1000 | " " + client.LastName; | 1006 | int maxRegionNameLength = 14; |
1001 | 1007 | int maxTypeLength = 4; | |
1002 | IStatsCollector stats = | 1008 | int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; |
1003 | (IStatsCollector) client; | 1009 | |
1004 | 1010 | report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", ""); | |
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", | 1011 | report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", ""); |
1006 | "Send", | 1012 | report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type", ""); |
1007 | "In", | 1013 | |
1008 | "Out", | 1014 | report.AppendFormat( |
1009 | "Resend", | 1015 | "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", |
1010 | "Land", | 1016 | "Packets", |
1011 | "Wind", | 1017 | "Packets", |
1012 | "Cloud", | 1018 | "Bytes", |
1013 | "Task", | 1019 | "Bytes", |
1014 | "Texture", | 1020 | "Bytes", |
1015 | "Asset"); | 1021 | "Bytes", |
1016 | report = report + stats.Report() + | 1022 | "Bytes", |
1017 | "\n"; | 1023 | "Bytes", |
1018 | } | 1024 | "Bytes", |
1019 | }); | 1025 | "Bytes", |
1020 | }); | 1026 | "Bytes"); |
1021 | 1027 | ||
1022 | return report; | 1028 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); |
1029 | report.AppendFormat( | ||
1030 | "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", | ||
1031 | "Out", | ||
1032 | "In", | ||
1033 | "Unacked", | ||
1034 | "Resend", | ||
1035 | "Land", | ||
1036 | "Wind", | ||
1037 | "Cloud", | ||
1038 | "Task", | ||
1039 | "Texture", | ||
1040 | "Asset", | ||
1041 | "State"); | ||
1042 | |||
1043 | m_sceneManager.ForEachScene( | ||
1044 | delegate(Scene scene) | ||
1045 | { | ||
1046 | scene.ForEachClient( | ||
1047 | delegate(IClientAPI client) | ||
1048 | { | ||
1049 | if (client is IStatsCollector) | ||
1050 | { | ||
1051 | bool isChild = scene.PresenceChildStatus(client.AgentId); | ||
1052 | if (isChild && !showChildren) | ||
1053 | return; | ||
1054 | |||
1055 | string name = client.Name; | ||
1056 | string regionName = scene.RegionInfo.RegionName; | ||
1057 | |||
1058 | report.AppendFormat( | ||
1059 | "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", | ||
1060 | name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); | ||
1061 | report.AppendFormat( | ||
1062 | "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", | ||
1063 | regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, ""); | ||
1064 | report.AppendFormat( | ||
1065 | "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", | ||
1066 | isChild ? "Cd" : "Rt", ""); | ||
1067 | |||
1068 | IStatsCollector stats = (IStatsCollector)client; | ||
1069 | |||
1070 | report.AppendLine(stats.Report()); | ||
1071 | } | ||
1072 | }); | ||
1073 | }); | ||
1074 | |||
1075 | return report.ToString(); | ||
1023 | } | 1076 | } |
1024 | 1077 | ||
1025 | /// <summary> | 1078 | /// <summary> |