diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index f3abd96818..0cef550749 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 queued for processing.
+ ///
+ long EventsQueued { get; }
+
///
/// Number of events processed by this script instance.
///
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 5bfe97a3fa..8e81e9fe30 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -173,6 +173,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public Queue EventQueue { get; private set; }
+ public long EventsQueued
+ {
+ get
+ {
+ lock (EventQueue)
+ return EventQueue.Count;
+ }
+ }
+
public long EventsProcessed { get; private set; }
public int StartParam { get; set; }
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 394826e066..aeb807ca99 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -526,10 +526,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
sb.AppendFormat("Script name : {0}\n", instance.ScriptName);
sb.AppendFormat("Status : {0}\n", status);
-
- lock (eq)
- sb.AppendFormat("Queued events : {0}\n", eq.Count);
-
+ sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued);
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);