aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs21
1 files changed, 20 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index 968351b..b177287 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -172,6 +172,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
172 172
173 public TaskInventoryItem ScriptTask { get; private set; } 173 public TaskInventoryItem ScriptTask { get; private set; }
174 174
175 public DateTime TimeStarted { get; private set; }
176
177 public long MeasurementPeriodTickStart { get; private set; }
178
179 public long MeasurementPeriodExecutionTime { get; private set; }
180
181 public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute;
182
175 public void ClearQueue() 183 public void ClearQueue()
176 { 184 {
177 m_TimerQueued = false; 185 m_TimerQueued = false;
@@ -458,6 +466,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
458 466
459 Running = true; 467 Running = true;
460 468
469 TimeStarted = DateTime.Now;
470 MeasurementPeriodTickStart = Util.EnvironmentTickCount();
471 MeasurementPeriodExecutionTime = 0;
472
461 if (EventQueue.Count > 0) 473 if (EventQueue.Count > 0)
462 { 474 {
463 if (m_CurrentWorkItem == null) 475 if (m_CurrentWorkItem == null)
@@ -710,8 +722,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
710 m_EventStart = DateTime.Now; 722 m_EventStart = DateTime.Now;
711 m_InEvent = true; 723 m_InEvent = true;
712 724
725 int start = Util.EnvironmentTickCount();
726
727 // Reset the measurement period when we reach the end of the current one.
728 if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod)
729 MeasurementPeriodTickStart = start;
730
713 m_Script.ExecuteEvent(State, data.EventName, data.Params); 731 m_Script.ExecuteEvent(State, data.EventName, data.Params);
714 732
733 MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start;
734
715 m_InEvent = false; 735 m_InEvent = false;
716 m_CurrentEvent = String.Empty; 736 m_CurrentEvent = String.Empty;
717 737
@@ -720,7 +740,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
720 // This will be the very first event we deliver 740 // This will be the very first event we deliver
721 // (state_entry) in default state 741 // (state_entry) in default state
722 // 742 //
723
724 SaveState(m_Assembly); 743 SaveState(m_Assembly);
725 744
726 m_SaveState = false; 745 m_SaveState = false;