From e3e38e34c5f58a3c466d1b651b41faf834ff5259 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 22:21:10 +0000 Subject: If a particular region is selected in the console, only try to delete objects in that region, rather than in every region on the simulator The old wrong behaviour was in place before the command was extracted to a module. --- .../World/Objects/Commands/ObjectCommandsModule.cs | 37 ++++++++++++---------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 57c109e..42eeb6c 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands // private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); private Scene m_scene; + private ICommandConsole m_console; public string Name { get { return "Object Commands Module"; } } @@ -75,36 +76,40 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands // m_log.DebugFormat("[OBJECT COMMANDS MODULE]: REGION {0} ADDED", scene.RegionInfo.RegionName); m_scene = scene; - } - - public void RemoveRegion(Scene scene) - { -// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); - } + m_console = MainConsole.Instance; - public void RegionLoaded(Scene scene) - { -// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); - - MainConsole.Instance.Commands.AddCommand("region", false, "delete object owner", + m_console.Commands.AddCommand("region", false, "delete object owner", "delete object owner ", "Delete object by owner", HandleDeleteObject); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object creator", + m_console.Commands.AddCommand("region", false, "delete object creator", "delete object creator ", "Delete object by creator", HandleDeleteObject); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object uuid", + m_console.Commands.AddCommand("region", false, "delete object uuid", "delete object uuid ", "Delete object by uuid", HandleDeleteObject); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object name", + m_console.Commands.AddCommand("region", false, "delete object name", "delete object name ", "Delete object by name", HandleDeleteObject); - MainConsole.Instance.Commands.AddCommand("region", false, "delete object outside", + m_console.Commands.AddCommand("region", false, "delete object outside", "delete object outside", "Delete all objects outside boundaries", HandleDeleteObject); } + public void RemoveRegion(Scene scene) + { +// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} REMOVED", scene.RegionInfo.RegionName); + } + + public void RegionLoaded(Scene scene) + { +// m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); + } + private void HandleDeleteObject(string module, string[] cmd) { + if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) + return; + if (cmd.Length < 3) return; @@ -198,7 +203,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands foreach (SceneObjectGroup g in deletes) { - MainConsole.Instance.OutputFormat("Deleting object {0}", g.UUID); + m_console.OutputFormat("Deleting object {0}", g.UUID); m_scene.DeleteSceneObject(g, false); } } -- cgit v1.1 From 77b032549ee8a12202a6aa974c6fd07761515d51 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 22:22:32 +0000 Subject: Add the name of a deleted object to the console output --- .../Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 42eeb6c..3e0f622 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -203,7 +203,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands foreach (SceneObjectGroup g in deletes) { - m_console.OutputFormat("Deleting object {0}", g.UUID); + m_console.OutputFormat("Deleting object {0} {1}", g.UUID, g.Name); m_scene.DeleteSceneObject(g, false); } } -- cgit v1.1 From 647b326edcd5f80e31ebbff8bd6501c0919c267b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 22:27:05 +0000 Subject: Add more user feedback if an object isn't found for which delete was requested. --- .../World/Objects/Commands/ObjectCommandsModule.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 3e0f622..78f86cc 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -140,6 +140,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); + if (deletes.Count == 0) + m_console.OutputFormat("No objects were found with owner {0}", match); + break; case "creator": @@ -152,6 +155,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); + if (deletes.Count == 0) + m_console.OutputFormat("No objects were found with creator {0}", match); + break; case "uuid": @@ -164,6 +170,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); + if (deletes.Count == 0) + m_console.OutputFormat("No objects were found with uuid {0}", match); + break; case "name": @@ -173,6 +182,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); + if (deletes.Count == 0) + m_console.OutputFormat("No objects were found with name {0}", o); + break; case "outside": @@ -198,6 +210,9 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); + if (deletes.Count == 0) + m_console.OutputFormat("No objects were found outside region bounds"); + break; } -- cgit v1.1 From ab89adfaefb7c2858cb2f90f783c010157d980a7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 23:03:39 +0000 Subject: Implement "show object uuid " console command. This will show details about a part with the given uuid if it's found. --- .../World/Objects/Commands/ObjectCommandsModule.cs | 61 ++++++++++++++++++++-- .../Region/Framework/Scenes/SceneObjectGroup.cs | 6 +++ 2 files changed, 62 insertions(+), 5 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index 78f86cc..b378f7a 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -80,19 +80,33 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands m_console.Commands.AddCommand("region", false, "delete object owner", "delete object owner ", - "Delete object by owner", HandleDeleteObject); + "Delete a scene object by owner", HandleDeleteObject); m_console.Commands.AddCommand("region", false, "delete object creator", "delete object creator ", - "Delete object by creator", HandleDeleteObject); + "Delete a scene object by creator", HandleDeleteObject); m_console.Commands.AddCommand("region", false, "delete object uuid", "delete object uuid ", - "Delete object by uuid", HandleDeleteObject); + "Delete a scene object by uuid", HandleDeleteObject); m_console.Commands.AddCommand("region", false, "delete object name", "delete object name ", - "Delete object by name", HandleDeleteObject); + "Delete a scene object by name", HandleDeleteObject); m_console.Commands.AddCommand("region", false, "delete object outside", "delete object outside", - "Delete all objects outside boundaries", HandleDeleteObject); + "Delete all scene objects outside region boundaries", HandleDeleteObject); + + m_console.Commands.AddCommand( + "region", + false, + "show object uuid", + "show object uuid ", + "Show details of a scene object with the given UUID", HandleShowObjectByUuid); + +// m_console.Commands.AddCommand( +// "region", +// false, +// "show object name ", +// "show object name ", +// "Show details of scene objects with the given name", HandleShowObjectName); } public void RemoveRegion(Scene scene) @@ -105,6 +119,43 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands // m_log.DebugFormat("[OBJECTS COMMANDS MODULE]: REGION {0} LOADED", scene.RegionInfo.RegionName); } + private void HandleShowObjectByUuid(string module, string[] cmd) + { + if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) + return; + + if (cmd.Length < 4) + { + m_console.OutputFormat("Usage: show object uuid "); + return; + } + + UUID objectUuid; + if (!UUID.TryParse(cmd[3], out objectUuid)) + { + m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); + return; + } + + SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); + + if (sop == null) + { + m_console.OutputFormat("No object found with uuid {0}", objectUuid); + return; + } + + StringBuilder sb = new StringBuilder(); + sb.AppendFormat("Name: {0}\n", sop.Name); + sb.AppendFormat("Description: {0}\n", sop.Description); + sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); + sb.AppendFormat("Parent: {0}", + sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); + sb.AppendFormat("Parts: {0}", sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString()); + + m_console.OutputFormat(sb.ToString()); + } + private void HandleDeleteObject(string module, string[] cmd) { if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 739c5fa..e7f2fdb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs @@ -264,6 +264,12 @@ namespace OpenSim.Region.Framework.Scenes set { RootPart.Name = value; } } + public string Description + { + get { return RootPart.Description; } + set { RootPart.Description = value; } + } + /// /// Added because the Parcel code seems to use it /// but not sure a object should have this -- cgit v1.1 From ac7cded080ff4db606c42f81b4d1f798fe7fa624 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 23:06:48 +0000 Subject: Get rid of the "no objects found" feedback for now - this doesn't work well if a command is executed over multiple scenes. --- .../World/Objects/Commands/ObjectCommandsModule.cs | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index b378f7a..d5a3e77 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -141,7 +141,7 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands if (sop == null) { - m_console.OutputFormat("No object found with uuid {0}", objectUuid); +// m_console.OutputFormat("No object found with uuid {0}", objectUuid); return; } @@ -191,8 +191,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); - if (deletes.Count == 0) - m_console.OutputFormat("No objects were found with owner {0}", match); +// if (deletes.Count == 0) +// m_console.OutputFormat("No objects were found with owner {0}", match); break; @@ -206,8 +206,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); - if (deletes.Count == 0) - m_console.OutputFormat("No objects were found with creator {0}", match); +// if (deletes.Count == 0) +// m_console.OutputFormat("No objects were found with creator {0}", match); break; @@ -221,8 +221,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); - if (deletes.Count == 0) - m_console.OutputFormat("No objects were found with uuid {0}", match); +// if (deletes.Count == 0) +// m_console.OutputFormat("No objects were found with uuid {0}", match); break; @@ -233,8 +233,8 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); - if (deletes.Count == 0) - m_console.OutputFormat("No objects were found with name {0}", o); +// if (deletes.Count == 0) +// m_console.OutputFormat("No objects were found with name {0}", o); break; @@ -261,12 +261,14 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands deletes.Add(g); }); - if (deletes.Count == 0) - m_console.OutputFormat("No objects were found outside region bounds"); +// if (deletes.Count == 0) +// m_console.OutputFormat("No objects were found outside region bounds"); break; } + m_console.OutputFormat("Deleting {0} objects in {1}", deletes.Count, m_scene.RegionInfo.RegionName); + foreach (SceneObjectGroup g in deletes) { m_console.OutputFormat("Deleting object {0} {1}", g.UUID, g.Name); -- cgit v1.1 From 996cc6097e7d5bbccd1a0b85a1d901686037e19b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 23:21:02 +0000 Subject: Implement "show object name " console command to show details of an object with the given name --- .../World/Objects/Commands/ObjectCommandsModule.cs | 57 +++++++++++++++++++--- 1 file changed, 49 insertions(+), 8 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index d5a3e77..d1ae4dc 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -101,12 +101,12 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands "show object uuid ", "Show details of a scene object with the given UUID", HandleShowObjectByUuid); -// m_console.Commands.AddCommand( -// "region", -// false, -// "show object name ", -// "show object name ", -// "Show details of scene objects with the given name", HandleShowObjectName); + m_console.Commands.AddCommand( + "region", + false, + "show object name", + "show object name ", + "Show details of scene objects with the given name", HandleShowObjectByName); } public void RemoveRegion(Scene scene) @@ -146,14 +146,55 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands } StringBuilder sb = new StringBuilder(); + AddPartReport(sb, sop); + + m_console.OutputFormat(sb.ToString()); + } + + private void HandleShowObjectByName(string module, string[] cmd) + { + if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) + return; + + if (cmd.Length < 4) + { + m_console.OutputFormat("Usage: show object name "); + return; + } + + string name = cmd[3]; + + List parts = new List(); + + m_scene.ForEachSOG(so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } })); + + if (parts.Count == 0) + { + m_console.OutputFormat("No parts with name {0} found in {1}", name, m_scene.RegionInfo.RegionName); + return; + } + + StringBuilder sb = new StringBuilder(); + + foreach (SceneObjectPart part in parts) + { + AddPartReport(sb, part); + sb.Append("\n"); + } + + m_console.OutputFormat(sb.ToString()); + } + + private StringBuilder AddPartReport(StringBuilder sb, SceneObjectPart sop) + { sb.AppendFormat("Name: {0}\n", sop.Name); sb.AppendFormat("Description: {0}\n", sop.Description); sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); sb.AppendFormat("Parent: {0}", sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); - sb.AppendFormat("Parts: {0}", sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString()); + sb.AppendFormat("Parts: {0}\n", sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; - m_console.OutputFormat(sb.ToString()); + return sb; } private void HandleDeleteObject(string module, string[] cmd) -- cgit v1.1 From f028dca711c7ebcda32e4b035eb667455e3bc29d Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 31 Jan 2012 23:35:13 +0000 Subject: Add "show part uuid" and "show part name" console commands. These commands will display part/prim details for a given uuid or name The "show object uuid" and "show object name" commands will now only display details for objects (i.e. not child parts in a linkset). This is for consistency with the "delete object" commands which only delete objects, not parts. --- .../World/Objects/Commands/ObjectCommandsModule.cs | 104 +++++++++++++++++++-- 1 file changed, 97 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs index d1ae4dc..e3d04cd 100644 --- a/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs +++ b/OpenSim/Region/CoreModules/World/Objects/Commands/ObjectCommandsModule.cs @@ -107,6 +107,20 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands "show object name", "show object name ", "Show details of scene objects with the given name", HandleShowObjectByName); + + m_console.Commands.AddCommand( + "region", + false, + "show part uuid", + "show part uuid ", + "Show details of a scene object parts with the given UUID", HandleShowPartByUuid); + + m_console.Commands.AddCommand( + "region", + false, + "show part name", + "show part name ", + "Show details of scene object parts with the given name", HandleShowPartByName); } public void RemoveRegion(Scene scene) @@ -137,16 +151,16 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands return; } - SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); + SceneObjectGroup so = m_scene.GetSceneObjectGroup(objectUuid); - if (sop == null) + if (so == null) { -// m_console.OutputFormat("No object found with uuid {0}", objectUuid); +// m_console.OutputFormat("No part found with uuid {0}", objectUuid); return; } StringBuilder sb = new StringBuilder(); - AddPartReport(sb, sop); + AddSceneObjectReport(sb, so); m_console.OutputFormat(sb.ToString()); } @@ -164,6 +178,72 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands string name = cmd[3]; + List sceneObjects = new List(); + + m_scene.ForEachSOG(so => { if (so.Name == name) { sceneObjects.Add(so); }}); + + if (sceneObjects.Count == 0) + { + m_console.OutputFormat("No objects with name {0} found in {1}", name, m_scene.RegionInfo.RegionName); + return; + } + + StringBuilder sb = new StringBuilder(); + + foreach (SceneObjectGroup so in sceneObjects) + { + AddSceneObjectReport(sb, so); + sb.Append("\n"); + } + + m_console.OutputFormat(sb.ToString()); + } + + private void HandleShowPartByUuid(string module, string[] cmd) + { + if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) + return; + + if (cmd.Length < 4) + { + m_console.OutputFormat("Usage: show part uuid "); + return; + } + + UUID objectUuid; + if (!UUID.TryParse(cmd[3], out objectUuid)) + { + m_console.OutputFormat("{0} is not a valid uuid", cmd[3]); + return; + } + + SceneObjectPart sop = m_scene.GetSceneObjectPart(objectUuid); + + if (sop == null) + { +// m_console.OutputFormat("No part found with uuid {0}", objectUuid); + return; + } + + StringBuilder sb = new StringBuilder(); + AddScenePartReport(sb, sop); + + m_console.OutputFormat(sb.ToString()); + } + + private void HandleShowPartByName(string module, string[] cmd) + { + if (!(m_console.ConsoleScene == null || m_console.ConsoleScene == m_scene)) + return; + + if (cmd.Length < 4) + { + m_console.OutputFormat("Usage: show part name "); + return; + } + + string name = cmd[3]; + List parts = new List(); m_scene.ForEachSOG(so => so.ForEachPart(sop => { if (sop.Name == name) { parts.Add(sop); } })); @@ -178,21 +258,31 @@ namespace OpenSim.Region.CoreModules.World.Objects.Commands foreach (SceneObjectPart part in parts) { - AddPartReport(sb, part); + AddScenePartReport(sb, part); sb.Append("\n"); } m_console.OutputFormat(sb.ToString()); } - private StringBuilder AddPartReport(StringBuilder sb, SceneObjectPart sop) + private StringBuilder AddSceneObjectReport(StringBuilder sb, SceneObjectGroup so) + { + sb.AppendFormat("Name: {0}\n", so.Name); + sb.AppendFormat("Description: {0}\n", so.Description); + sb.AppendFormat("Location: {0} @ {1}\n", so.AbsolutePosition, so.Scene.RegionInfo.RegionName); + sb.AppendFormat("Parts: {0}\n", so.PrimCount); + + return sb; + } + + private StringBuilder AddScenePartReport(StringBuilder sb, SceneObjectPart sop) { sb.AppendFormat("Name: {0}\n", sop.Name); sb.AppendFormat("Description: {0}\n", sop.Description); sb.AppendFormat("Location: {0} @ {1}\n", sop.AbsolutePosition, sop.ParentGroup.Scene.RegionInfo.RegionName); sb.AppendFormat("Parent: {0}", sop.IsRoot ? "Is Root\n" : string.Format("{0} {1}\n", sop.ParentGroup.Name, sop.ParentGroup.UUID)); - sb.AppendFormat("Parts: {0}\n", sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; + sb.AppendFormat("Parts: {0}\n", !sop.IsRoot ? "1" : sop.ParentGroup.PrimCount.ToString());; return sb; } -- cgit v1.1 From 437de6743c98b9ab217ac56ca6646883ca44c240 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 1 Feb 2012 00:07:06 +0000 Subject: Implement "xengine status" console command to show various xengine stats --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 32 ++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c9bbf0e..c9fb722 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -26,14 +26,15 @@ */ using System; -using System.IO; -using System.Threading; using System.Collections; using System.Collections.Generic; +using System.Globalization; +using System.IO; +using System.Reflection; using System.Security; using System.Security.Policy; -using System.Reflection; -using System.Globalization; +using System.Text; +using System.Threading; using System.Xml; using OpenMetaverse; using OpenMetaverse.StructuredData; @@ -273,6 +274,11 @@ namespace OpenSim.Region.ScriptEngine.XEngine } MainConsole.Instance.Commands.AddCommand( + "scripts", false, "xengine status", "xengine status", "Show status information", + "Show status information on the script engine.", + HandleShowStatus); + + MainConsole.Instance.Commands.AddCommand( "scripts", false, "scripts show", "scripts show []", "Show script information", "Show information on all scripts known to the script engine." + "If a is given then only information on that script will be shown.", @@ -359,6 +365,24 @@ namespace OpenSim.Region.ScriptEngine.XEngine } } + private void HandleShowStatus(string module, string[] cmdparams) + { + StringBuilder sb = new StringBuilder(); + sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName); + + lock (m_Scripts) + sb.AppendFormat("Scripts loaded : {0}\n", m_Scripts.Count); + + sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); + sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); + sb.AppendFormat("Allocated threads : {0}\n", m_ThreadPool.ActiveThreads); + sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); + sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); +// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); + + MainConsole.Instance.OutputFormat(sb.ToString()); + } + public void HandleShowScripts(string module, string[] cmdparams) { if (cmdparams.Length == 2) -- cgit v1.1 From 8b3da1bff4344d4dc7738f97e5aaa6d024db8f7e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 1 Feb 2012 00:10:07 +0000 Subject: Make script console commands only show for selected region. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c9fb722..459821b 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -324,6 +324,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine /// true if we're okay to proceed, false if not. private void HandleScriptsAction(string[] cmdparams, Action action) { + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) + return; + lock (m_Scripts) { string rawItemId; @@ -367,6 +370,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine private void HandleShowStatus(string module, string[] cmdparams) { + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) + return; + StringBuilder sb = new StringBuilder(); sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName); @@ -385,6 +391,9 @@ namespace OpenSim.Region.ScriptEngine.XEngine public void HandleShowScripts(string module, string[] cmdparams) { + if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) + return; + if (cmdparams.Length == 2) { lock (m_Scripts) -- cgit v1.1 From e3680f216eeb631cd8955a708b1eee492566fa5c Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 1 Feb 2012 00:17:02 +0000 Subject: Add count of events queued for a particular script in "scripts show" console command --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 459821b..13c5cd9 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -428,10 +428,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine status = "running"; } - MainConsole.Instance.OutputFormat( - "{0}.{1}, item UUID {2}, prim UUID {3} @ {4} ({5})", - instance.PrimName, instance.ScriptName, instance.ItemID, instance.ObjectID, - sop.AbsolutePosition, status); + Queue eq = instance.EventQueue; + + lock (eq) + { + MainConsole.Instance.OutputFormat( + "{0}.{1}, queued events = {2}, item UUID {3}, prim UUID {4} @ {5} ({6})", + instance.PrimName, instance.ScriptName, eq.Count, instance.ItemID, instance.ObjectID, + sop.AbsolutePosition, status); + } } private void HandleSuspendScript(IScriptInstance instance) -- cgit v1.1 From 99e71222f05345d7c4e1658bf52b90087cad7ab7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 1 Feb 2012 00:27:42 +0000 Subject: Lay out script status in property per row format, since getting too long for console lines. --- OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 13c5cd9..f11987e 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -428,15 +428,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine status = "running"; } + StringBuilder sb = new StringBuilder(); Queue eq = instance.EventQueue; + sb.AppendFormat("Script name : {0}\n", instance.ScriptName); + sb.AppendFormat("Status : {0}\n", status); + lock (eq) - { - MainConsole.Instance.OutputFormat( - "{0}.{1}, queued events = {2}, item UUID {3}, prim UUID {4} @ {5} ({6})", - instance.PrimName, instance.ScriptName, eq.Count, instance.ItemID, instance.ObjectID, - sop.AbsolutePosition, status); - } + sb.AppendFormat("Queued events : {0}\n", eq.Count); + + sb.AppendFormat("Item UUID : {0}\n", instance.ItemID); + sb.AppendFormat("Containing part name: {0}\n", instance.PrimName); + sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID); + sb.AppendFormat("Position : {0}\n", sop.AbsolutePosition); + + MainConsole.Instance.OutputFormat(sb.ToString()); } private void HandleSuspendScript(IScriptInstance instance) -- cgit v1.1 From 3d7b5e5e93b4d9f8c2ad3be8241ee0a484fe222b Mon Sep 17 00:00:00 2001 From: Diva Canto Date: Tue, 31 Jan 2012 22:00:59 -0800 Subject: HG: This hopefully fixes the HG teleports back home to OSGrid. Looks like Uri.ToString() drops the port when it's port 80. --- .../CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs index 8d41728..38a7805 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/HGEntityTransferModule.cs @@ -348,7 +348,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer region.ExternalHostName = uri.Host; region.HttpPort = (uint)uri.Port; - region.ServerURI = uri.ToString(); + region.ServerURI = aCircuit.ServiceURLs["HomeURI"].ToString(); region.RegionName = string.Empty; region.InternalEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse("0.0.0.0"), (int)0); return region; -- cgit v1.1