From c2bdb36c11ad0d45114bb3b38ae1c234e70a44f0 Mon Sep 17 00:00:00 2001 From: "Justin Clark-Casey (justincc)" Date: Wed, 5 Dec 2012 22:33:28 +0000 Subject: [PATCH] Add IScriptInstance.EventsProcessed stat so that we can record this information and display in "show scripts" for debug purposes --- OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 5 +++++ .../Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 4 ++++ OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 1 + 3 files changed, 10 insertions(+) diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs index b04f6b6624..f3abd96818 100644 --- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs @@ -114,6 +114,11 @@ namespace OpenSim.Region.ScriptEngine.Interfaces UUID AssetID { get; } Queue EventQueue { get; } + /// + /// Number of events processed by this script instance. + /// + long EventsProcessed { get; } + void ClearQueue(); int StartParam { get; set; } diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index 5793cc9de6..5bfe97a3fa 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs @@ -173,6 +173,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance public Queue EventQueue { get; private set; } + public long EventsProcessed { get; private set; } + public int StartParam { get; set; } public TaskInventoryItem ScriptTask { get; private set; } @@ -808,6 +810,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance // script engine to run the next event. lock (EventQueue) { + EventsProcessed++; + if (EventQueue.Count > 0 && Running && !ShuttingDown) { m_CurrentWorkItem = Engine.QueueEventHandler(this); diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 78096f8963..41b5aa86b6 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs @@ -512,6 +512,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine lock (eq) sb.AppendFormat("Queued events : {0}\n", eq.Count); + sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed); 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);