From 4beef91d006ed18cb7dc4a6ee8f2dc4e2a71ab6f Mon Sep 17 00:00:00 2001 From: Tedd Hansen Date: Wed, 22 Aug 2007 19:33:10 +0000 Subject: GC.GetTotalMemory(true) was blocking. We now support individual scripts on individual prims. Do the script dance... \o/ \o\ /o/ \o/ .o. --- OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs | 6 ++++-- OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs | 9 +++------ OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs | 3 +++ OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs | 11 +++++++---- 4 files changed, 17 insertions(+), 12 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs index 49f6712..3319783 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs @@ -58,6 +58,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine /// Free AppDomain private AppDomainStructure GetFreeAppDomain() { + Console.WriteLine("Finding free AppDomain"); FreeAppDomains(); // Outsite lock, has its own GetLock lock (GetLock) { @@ -141,8 +142,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Find next available AppDomain to put it in AppDomainStructure FreeAppDomain = GetFreeAppDomain(); - if (FreeAppDomain == null) Console.WriteLine("FreeAppDomain == null"); - if (FreeAppDomain.CurrentAppDomain == null) Console.WriteLine("FreeAppDomain.CurrentAppDomain == null"); + //if (FreeAppDomain == null) Console.WriteLine("FreeAppDomain == null"); + //if (FreeAppDomain.CurrentAppDomain == null) Console.WriteLine("FreeAppDomain.CurrentAppDomain == null"); + Console.WriteLine("Loading into AppDomain: " + FileName); LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script"); //Type mytype = mbrt.GetType(); Console.WriteLine("ScriptEngine AppDomainManager: is proxy={0}", RemotingServices.IsTransparentProxy(mbrt)); diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs index 4343ea1..a20a95a 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventManager.cs @@ -51,7 +51,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // TODO: ADD SERVER HOOK TO LOAD A SCRIPT THROUGH myScriptEngine.ScriptManager // Hook up a test event to our test form - //myScriptEngine.Log.Verbose("ScriptEngine", "EventManager Hooking up to server events"); + myScriptEngine.Log.Verbose("ScriptEngine", "Hooking up to server events"); myScriptEngine.World.EventManager.OnObjectGrab += new OpenSim.Region.Environment.Scenes.EventManager.ObjectGrabDelegate(touch_start); myScriptEngine.World.EventManager.OnRezScript += new OpenSim.Region.Environment.Scenes.EventManager.NewRezScript(OnRezScript); myScriptEngine.World.EventManager.OnRemoveScript += new OpenSim.Region.Environment.Scenes.EventManager.RemoveScript(OnRemoveScript); @@ -62,6 +62,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine { // Add to queue for all scripts in ObjectID object //myScriptEngine.m_logger.Verbose("ScriptEngine", "EventManager Event: touch_start"); + Console.WriteLine("touch_start localID: " + localID); myScriptEngine.myEventQueueManager.AddToObjectQueue(localID, "touch_start", new object[] { (int)1 }); } public void OnRezScript(uint localID, LLUUID itemID, string script) @@ -75,11 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // new OpenSim.Region.Environment.Scenes.Scripting.NullScriptHost() //); Console.WriteLine("OnRezScript localID: " + localID + " LLUID: " + itemID.ToString() + " Size: " + script.Length); - myScriptEngine.myScriptManager.StartScript( - localID, - itemID, - script - ); + myScriptEngine.myScriptManager.StartScript(localID, itemID, script); } public void OnRemoveScript(uint localID, LLUUID itemID) diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs index 23cd4e8..a436bff 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/EventQueueManager.cs @@ -241,7 +241,10 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine // Do we have any scripts in this object at all? If not, return if (myScriptEngine.myScriptManager.Scripts.ContainsKey(localID) == false) + { + Console.WriteLine("Event \"" + FunctionName + "\" for localID: " + localID + ". No scripts found on this localID."); return; + } foreach (LLUUID itemID in myScriptEngine.myScriptManager.GetScriptKeys(localID)) { diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs index b7a4aca..efd5a7f 100644 --- a/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/DotNetEngine/ScriptManager.cs @@ -169,11 +169,14 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSO.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName); //OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass Script = LoadAndInitAssembly(FreeAppDomain, FileName, localID); - long before; - before = GC.GetTotalMemory(true); + + //long before; + //before = GC.GetTotalMemory(true); LSL_BaseClass CompiledScript = m_scriptEngine.myAppDomainManager.LoadScript(FileName); - Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); - before = GC.GetTotalMemory(true); + //Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); + //before = GC.GetTotalMemory(true); + + //Script = m_scriptEngine.myAppDomainManager.LoadScript(FileName); //Console.WriteLine("Script occupies {0} bytes", GC.GetTotalMemory(true) - before); //before = GC.GetTotalMemory(true); -- cgit v1.1