diff options
author | BlueWall | 2011-01-27 08:53:57 -0500 |
---|---|---|
committer | BlueWall | 2011-01-27 08:53:57 -0500 |
commit | d89d9d1b1310d494fbb7712057eab8a196e10a04 (patch) | |
tree | 62834b7f5954aa8f013a159ee2fc3ccee385e673 /OpenSim/Region/Application | |
parent | Make FireAndForgetWrapper a singleton class (diff) | |
parent | Make it work (diff) | |
download | opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.zip opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.gz opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.bz2 opensim-SC_OLD-d89d9d1b1310d494fbb7712057eab8a196e10a04.tar.xz |
Merge branch 'master' of /home/opensim/src/OpenSim/Core
Diffstat (limited to 'OpenSim/Region/Application')
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 173 |
1 files changed, 44 insertions, 129 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 51eb396..ed4b620 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -283,10 +283,6 @@ namespace OpenSim | |||
283 | "kick user <first> <last> [message]", | 283 | "kick user <first> <last> [message]", |
284 | "Kick a user off the simulator", KickUserCommand); | 284 | "Kick a user off the simulator", KickUserCommand); |
285 | 285 | ||
286 | m_console.Commands.AddCommand("region", false, "show assets", | ||
287 | "show assets", | ||
288 | "Show asset data", HandleShow); | ||
289 | |||
290 | m_console.Commands.AddCommand("region", false, "show users", | 286 | m_console.Commands.AddCommand("region", false, "show users", |
291 | "show users [full]", | 287 | "show users [full]", |
292 | "Show user data for users currently on the region", | 288 | "Show user data for users currently on the region", |
@@ -305,13 +301,6 @@ namespace OpenSim | |||
305 | m_console.Commands.AddCommand("region", false, "show regions", | 301 | m_console.Commands.AddCommand("region", false, "show regions", |
306 | "show regions", | 302 | "show regions", |
307 | "Show region data", HandleShow); | 303 | "Show region data", HandleShow); |
308 | |||
309 | m_console.Commands.AddCommand("region", false, "show queues", | ||
310 | "show queues [full]", | ||
311 | "Show queue data for each client", | ||
312 | "Without the 'full' option, only users actually on the region are shown." | ||
313 | + " With the 'full' option child agents of users in neighbouring regions are also shown.", | ||
314 | HandleShow); | ||
315 | 304 | ||
316 | m_console.Commands.AddCommand("region", false, "show ratings", | 305 | m_console.Commands.AddCommand("region", false, "show ratings", |
317 | "show ratings", | 306 | "show ratings", |
@@ -335,16 +324,19 @@ namespace OpenSim | |||
335 | "Restart all sims in this instance", RunCommand); | 324 | "Restart all sims in this instance", RunCommand); |
336 | 325 | ||
337 | m_console.Commands.AddCommand("region", false, "config set", | 326 | m_console.Commands.AddCommand("region", false, "config set", |
338 | "config set <section> <field> <value>", | 327 | "config set <section> <key> <value>", |
339 | "Set a config option", HandleConfig); | 328 | "Set a config option. In most cases this is not useful since changed parameters are not dynamically reloaded. Neither do changed parameters persist - you will have to change a config file manually and restart.", HandleConfig); |
340 | 329 | ||
341 | m_console.Commands.AddCommand("region", false, "config get", | 330 | m_console.Commands.AddCommand("region", false, "config get", |
342 | "config get <section> <field>", | 331 | "config get [<section>] [<key>]", |
343 | "Read a config option", HandleConfig); | 332 | "Show a config option", |
333 | "If neither section nor field are specified, then the whole current configuration is printed." + Environment.NewLine | ||
334 | + "If a section is given but not a field, then all fields in that section are printed.", | ||
335 | HandleConfig); | ||
344 | 336 | ||
345 | m_console.Commands.AddCommand("region", false, "config save", | 337 | m_console.Commands.AddCommand("region", false, "config save", |
346 | "config save", | 338 | "config save <path>", |
347 | "Save current configuration", HandleConfig); | 339 | "Save current configuration to a file at the given path", HandleConfig); |
348 | 340 | ||
349 | m_console.Commands.AddCommand("region", false, "command-script", | 341 | m_console.Commands.AddCommand("region", false, "command-script", |
350 | "command-script <script>", | 342 | "command-script <script>", |
@@ -586,7 +578,6 @@ namespace OpenSim | |||
586 | List<string> args = new List<string>(cmd); | 578 | List<string> args = new List<string>(cmd); |
587 | args.RemoveAt(0); | 579 | args.RemoveAt(0); |
588 | string[] cmdparams = args.ToArray(); | 580 | string[] cmdparams = args.ToArray(); |
589 | string n = "CONFIG"; | ||
590 | 581 | ||
591 | if (cmdparams.Length > 0) | 582 | if (cmdparams.Length > 0) |
592 | { | 583 | { |
@@ -595,8 +586,8 @@ namespace OpenSim | |||
595 | case "set": | 586 | case "set": |
596 | if (cmdparams.Length < 4) | 587 | if (cmdparams.Length < 4) |
597 | { | 588 | { |
598 | MainConsole.Instance.Output(String.Format("SYNTAX: {0} SET SECTION KEY VALUE",n)); | 589 | Notice("Syntax: config set <section> <key> <value>"); |
599 | MainConsole.Instance.Output(String.Format("EXAMPLE: {0} SET ScriptEngine.DotNetEngine NumberOfScriptThreads 5",n)); | 590 | Notice("Example: config set ScriptEngine.DotNetEngine NumberOfScriptThreads 5"); |
600 | } | 591 | } |
601 | else | 592 | else |
602 | { | 593 | { |
@@ -609,48 +600,68 @@ namespace OpenSim | |||
609 | c.Set(cmdparams[2], _value); | 600 | c.Set(cmdparams[2], _value); |
610 | m_config.Source.Merge(source); | 601 | m_config.Source.Merge(source); |
611 | 602 | ||
612 | MainConsole.Instance.Output(String.Format("{0} {0} {1} {2} {3}",n,cmdparams[1],cmdparams[2],_value)); | 603 | Notice("In section [{0}], set {1} = {2}", c.Name, cmdparams[2], _value); |
613 | } | 604 | } |
614 | } | 605 | } |
615 | break; | 606 | break; |
616 | 607 | ||
617 | case "get": | 608 | case "get": |
618 | if (cmdparams.Length < 3) | 609 | if (cmdparams.Length == 1) |
619 | { | 610 | { |
620 | MainConsole.Instance.Output(String.Format("SYNTAX: {0} GET SECTION KEY",n)); | 611 | foreach (IConfig config in m_config.Source.Configs) |
621 | MainConsole.Instance.Output(String.Format("EXAMPLE: {0} GET ScriptEngine.DotNetEngine NumberOfScriptThreads",n)); | 612 | { |
613 | Notice("[{0}]", config.Name); | ||
614 | string[] keys = config.GetKeys(); | ||
615 | foreach (string key in keys) | ||
616 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
617 | } | ||
622 | } | 618 | } |
623 | else | 619 | else if (cmdparams.Length == 2 || cmdparams.Length == 3) |
624 | { | 620 | { |
625 | IConfig c = m_config.Source.Configs[cmdparams[1]]; | 621 | IConfig config = m_config.Source.Configs[cmdparams[1]]; |
626 | if (c == null) | 622 | if (config == null) |
627 | { | 623 | { |
628 | MainConsole.Instance.Output(String.Format("Section \"{0}\" does not exist.",cmdparams[1])); | 624 | Notice("Section \"{0}\" does not exist.",cmdparams[1]); |
629 | break; | 625 | break; |
630 | } | 626 | } |
631 | else | 627 | else |
632 | { | 628 | { |
633 | MainConsole.Instance.Output(String.Format("{0} GET {1} {2} : {3}",n,cmdparams[1],cmdparams[2], | 629 | if (cmdparams.Length == 2) |
634 | c.GetString(cmdparams[2]))); | 630 | { |
631 | Notice("[{0}]", config.Name); | ||
632 | foreach (string key in config.GetKeys()) | ||
633 | Notice(" {0} = {1}", key, config.GetString(key)); | ||
634 | } | ||
635 | else | ||
636 | { | ||
637 | Notice( | ||
638 | "config get {0} {1} : {2}", | ||
639 | cmdparams[1], cmdparams[2], config.GetString(cmdparams[2])); | ||
640 | } | ||
635 | } | 641 | } |
636 | } | 642 | } |
643 | else | ||
644 | { | ||
645 | Notice("Syntax: config get [<section>] [<key>]"); | ||
646 | Notice("Example: config get ScriptEngine.DotNetEngine NumberOfScriptThreads"); | ||
647 | } | ||
637 | 648 | ||
638 | break; | 649 | break; |
639 | 650 | ||
640 | case "save": | 651 | case "save": |
641 | if (cmdparams.Length < 2) | 652 | if (cmdparams.Length < 2) |
642 | { | 653 | { |
643 | MainConsole.Instance.Output("SYNTAX: " + n + " SAVE FILE"); | 654 | Notice("Syntax: config save <path>"); |
644 | return; | 655 | return; |
645 | } | 656 | } |
646 | 657 | ||
647 | if (Application.iniFilePath == cmdparams[1]) | 658 | if (Application.iniFilePath == cmdparams[1]) |
648 | { | 659 | { |
649 | MainConsole.Instance.Output("FILE can not be " + Application.iniFilePath); | 660 | Notice("Path can not be " + Application.iniFilePath); |
650 | return; | 661 | return; |
651 | } | 662 | } |
652 | 663 | ||
653 | MainConsole.Instance.Output("Saving configuration file: " + cmdparams[1]); | 664 | Notice("Saving configuration file: " + cmdparams[1]); |
654 | m_config.Save(cmdparams[1]); | 665 | m_config.Save(cmdparams[1]); |
655 | break; | 666 | break; |
656 | } | 667 | } |
@@ -869,10 +880,6 @@ namespace OpenSim | |||
869 | 880 | ||
870 | switch (showParams[0]) | 881 | switch (showParams[0]) |
871 | { | 882 | { |
872 | case "assets": | ||
873 | MainConsole.Instance.Output("Not implemented."); | ||
874 | break; | ||
875 | |||
876 | case "users": | 883 | case "users": |
877 | IList agents; | 884 | IList agents; |
878 | if (showParams.Length > 1 && showParams[1] == "full") | 885 | if (showParams.Length > 1 && showParams[1] == "full") |
@@ -959,10 +966,6 @@ namespace OpenSim | |||
959 | }); | 966 | }); |
960 | break; | 967 | break; |
961 | 968 | ||
962 | case "queues": | ||
963 | Notice(GetQueuesReport(showParams)); | ||
964 | break; | ||
965 | |||
966 | case "ratings": | 969 | case "ratings": |
967 | m_sceneManager.ForEachScene( | 970 | m_sceneManager.ForEachScene( |
968 | delegate(Scene scene) | 971 | delegate(Scene scene) |
@@ -990,94 +993,6 @@ namespace OpenSim | |||
990 | } | 993 | } |
991 | 994 | ||
992 | /// <summary> | 995 | /// <summary> |
993 | /// Generate UDP Queue data report for each client | ||
994 | /// </summary> | ||
995 | /// <param name="showParams"></param> | ||
996 | /// <returns></returns> | ||
997 | private string GetQueuesReport(string[] showParams) | ||
998 | { | ||
999 | bool showChildren = false; | ||
1000 | |||
1001 | if (showParams.Length > 1 && showParams[1] == "full") | ||
1002 | showChildren = true; | ||
1003 | |||
1004 | StringBuilder report = new StringBuilder(); | ||
1005 | |||
1006 | int columnPadding = 2; | ||
1007 | int maxNameLength = 18; | ||
1008 | int maxRegionNameLength = 14; | ||
1009 | int maxTypeLength = 4; | ||
1010 | int totalInfoFieldsLength = maxNameLength + columnPadding + maxRegionNameLength + columnPadding + maxTypeLength + columnPadding; | ||
1011 | |||
1012 | report.AppendFormat("{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", "User", ""); | ||
1013 | report.AppendFormat("{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", "Region", ""); | ||
1014 | report.AppendFormat("{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", "Type", ""); | ||
1015 | |||
1016 | report.AppendFormat( | ||
1017 | "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", | ||
1018 | "Packets", | ||
1019 | "Packets", | ||
1020 | "Bytes", | ||
1021 | "Bytes", | ||
1022 | "Bytes", | ||
1023 | "Bytes", | ||
1024 | "Bytes", | ||
1025 | "Bytes", | ||
1026 | "Bytes", | ||
1027 | "Bytes", | ||
1028 | "Bytes"); | ||
1029 | |||
1030 | report.AppendFormat("{0,-" + totalInfoFieldsLength + "}", ""); | ||
1031 | report.AppendFormat( | ||
1032 | "{0,9} {1,9} {2,9} {3,8} {4,7} {5,7} {6,7} {7,7} {8,9} {9,7} {10,7}\n", | ||
1033 | "Out", | ||
1034 | "In", | ||
1035 | "Unacked", | ||
1036 | "Resend", | ||
1037 | "Land", | ||
1038 | "Wind", | ||
1039 | "Cloud", | ||
1040 | "Task", | ||
1041 | "Texture", | ||
1042 | "Asset", | ||
1043 | "State"); | ||
1044 | |||
1045 | m_sceneManager.ForEachScene( | ||
1046 | delegate(Scene scene) | ||
1047 | { | ||
1048 | scene.ForEachClient( | ||
1049 | delegate(IClientAPI client) | ||
1050 | { | ||
1051 | if (client is IStatsCollector) | ||
1052 | { | ||
1053 | bool isChild = scene.PresenceChildStatus(client.AgentId); | ||
1054 | if (isChild && !showChildren) | ||
1055 | return; | ||
1056 | |||
1057 | string name = client.Name; | ||
1058 | string regionName = scene.RegionInfo.RegionName; | ||
1059 | |||
1060 | report.AppendFormat( | ||
1061 | "{0,-" + maxNameLength + "}{1,-" + columnPadding + "}", | ||
1062 | name.Length > maxNameLength ? name.Substring(0, maxNameLength) : name, ""); | ||
1063 | report.AppendFormat( | ||
1064 | "{0,-" + maxRegionNameLength + "}{1,-" + columnPadding + "}", | ||
1065 | regionName.Length > maxRegionNameLength ? regionName.Substring(0, maxRegionNameLength) : regionName, ""); | ||
1066 | report.AppendFormat( | ||
1067 | "{0,-" + maxTypeLength + "}{1,-" + columnPadding + "}", | ||
1068 | isChild ? "Cd" : "Rt", ""); | ||
1069 | |||
1070 | IStatsCollector stats = (IStatsCollector)client; | ||
1071 | |||
1072 | report.AppendLine(stats.Report()); | ||
1073 | } | ||
1074 | }); | ||
1075 | }); | ||
1076 | |||
1077 | return report.ToString(); | ||
1078 | } | ||
1079 | |||
1080 | /// <summary> | ||
1081 | /// Use XML2 format to serialize data to a file | 996 | /// Use XML2 format to serialize data to a file |
1082 | /// </summary> | 997 | /// </summary> |
1083 | /// <param name="module"></param> | 998 | /// <param name="module"></param> |