diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index f40da01..ff1f277 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -165,6 +165,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
165 | 165 | ||
166 | public uint LocalID { get; private set; } | 166 | public uint LocalID { get; private set; } |
167 | 167 | ||
168 | public UUID RootObjectID { get; private set; } | ||
169 | |||
170 | public uint RootLocalID { get; private set; } | ||
171 | |||
168 | public UUID AssetID { get; private set; } | 172 | public UUID AssetID { get; private set; } |
169 | 173 | ||
170 | public Queue EventQueue { get; private set; } | 174 | public Queue EventQueue { get; private set; } |
@@ -173,6 +177,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
173 | 177 | ||
174 | public TaskInventoryItem ScriptTask { get; private set; } | 178 | public TaskInventoryItem ScriptTask { get; private set; } |
175 | 179 | ||
180 | public DateTime TimeStarted { get; private set; } | ||
181 | |||
182 | public long MeasurementPeriodTickStart { get; private set; } | ||
183 | |||
184 | public long MeasurementPeriodExecutionTime { get; private set; } | ||
185 | |||
186 | public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; | ||
187 | |||
176 | public void ClearQueue() | 188 | public void ClearQueue() |
177 | { | 189 | { |
178 | m_TimerQueued = false; | 190 | m_TimerQueued = false; |
@@ -191,6 +203,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
191 | Engine = engine; | 203 | Engine = engine; |
192 | LocalID = part.LocalId; | 204 | LocalID = part.LocalId; |
193 | ObjectID = part.UUID; | 205 | ObjectID = part.UUID; |
206 | RootLocalID = part.ParentGroup.LocalId; | ||
207 | RootObjectID = part.ParentGroup.UUID; | ||
194 | ItemID = itemID; | 208 | ItemID = itemID; |
195 | AssetID = assetID; | 209 | AssetID = assetID; |
196 | PrimName = primName; | 210 | PrimName = primName; |
@@ -459,6 +473,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
459 | 473 | ||
460 | Running = true; | 474 | Running = true; |
461 | 475 | ||
476 | TimeStarted = DateTime.Now; | ||
477 | MeasurementPeriodTickStart = Util.EnvironmentTickCount(); | ||
478 | MeasurementPeriodExecutionTime = 0; | ||
479 | |||
462 | if (EventQueue.Count > 0) | 480 | if (EventQueue.Count > 0) |
463 | { | 481 | { |
464 | if (m_CurrentWorkItem == null) | 482 | if (m_CurrentWorkItem == null) |
@@ -712,8 +730,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
712 | m_EventStart = DateTime.Now; | 730 | m_EventStart = DateTime.Now; |
713 | m_InEvent = true; | 731 | m_InEvent = true; |
714 | 732 | ||
733 | int start = Util.EnvironmentTickCount(); | ||
734 | |||
735 | // Reset the measurement period when we reach the end of the current one. | ||
736 | if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod) | ||
737 | MeasurementPeriodTickStart = start; | ||
738 | |||
715 | m_Script.ExecuteEvent(State, data.EventName, data.Params); | 739 | m_Script.ExecuteEvent(State, data.EventName, data.Params); |
716 | 740 | ||
741 | MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start; | ||
742 | |||
717 | m_InEvent = false; | 743 | m_InEvent = false; |
718 | m_CurrentEvent = String.Empty; | 744 | m_CurrentEvent = String.Empty; |
719 | 745 | ||
@@ -722,7 +748,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
722 | // This will be the very first event we deliver | 748 | // This will be the very first event we deliver |
723 | // (state_entry) in default state | 749 | // (state_entry) in default state |
724 | // | 750 | // |
725 | |||
726 | SaveState(m_Assembly); | 751 | SaveState(m_Assembly); |
727 | 752 | ||
728 | m_SaveState = false; | 753 | m_SaveState = false; |