diff options
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
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 968351b..6e36742 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -164,6 +164,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
164 | 164 | ||
165 | public uint LocalID { get; private set; } | 165 | public uint LocalID { get; private set; } |
166 | 166 | ||
167 | public UUID RootObjectID { get; private set; } | ||
168 | |||
169 | public uint RootLocalID { get; private set; } | ||
170 | |||
167 | public UUID AssetID { get; private set; } | 171 | public UUID AssetID { get; private set; } |
168 | 172 | ||
169 | public Queue EventQueue { get; private set; } | 173 | public Queue EventQueue { get; private set; } |
@@ -172,6 +176,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
172 | 176 | ||
173 | public TaskInventoryItem ScriptTask { get; private set; } | 177 | public TaskInventoryItem ScriptTask { get; private set; } |
174 | 178 | ||
179 | public DateTime TimeStarted { get; private set; } | ||
180 | |||
181 | public long MeasurementPeriodTickStart { get; private set; } | ||
182 | |||
183 | public long MeasurementPeriodExecutionTime { get; private set; } | ||
184 | |||
185 | public static readonly long MaxMeasurementPeriod = 30 * TimeSpan.TicksPerMinute; | ||
186 | |||
175 | public void ClearQueue() | 187 | public void ClearQueue() |
176 | { | 188 | { |
177 | m_TimerQueued = false; | 189 | m_TimerQueued = false; |
@@ -190,6 +202,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
190 | Engine = engine; | 202 | Engine = engine; |
191 | LocalID = part.LocalId; | 203 | LocalID = part.LocalId; |
192 | ObjectID = part.UUID; | 204 | ObjectID = part.UUID; |
205 | RootLocalID = part.ParentGroup.LocalId; | ||
206 | RootObjectID = part.ParentGroup.UUID; | ||
193 | ItemID = itemID; | 207 | ItemID = itemID; |
194 | AssetID = assetID; | 208 | AssetID = assetID; |
195 | PrimName = primName; | 209 | PrimName = primName; |
@@ -458,6 +472,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
458 | 472 | ||
459 | Running = true; | 473 | Running = true; |
460 | 474 | ||
475 | TimeStarted = DateTime.Now; | ||
476 | MeasurementPeriodTickStart = Util.EnvironmentTickCount(); | ||
477 | MeasurementPeriodExecutionTime = 0; | ||
478 | |||
461 | if (EventQueue.Count > 0) | 479 | if (EventQueue.Count > 0) |
462 | { | 480 | { |
463 | if (m_CurrentWorkItem == null) | 481 | if (m_CurrentWorkItem == null) |
@@ -710,8 +728,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
710 | m_EventStart = DateTime.Now; | 728 | m_EventStart = DateTime.Now; |
711 | m_InEvent = true; | 729 | m_InEvent = true; |
712 | 730 | ||
731 | int start = Util.EnvironmentTickCount(); | ||
732 | |||
733 | // Reset the measurement period when we reach the end of the current one. | ||
734 | if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod) | ||
735 | MeasurementPeriodTickStart = start; | ||
736 | |||
713 | m_Script.ExecuteEvent(State, data.EventName, data.Params); | 737 | m_Script.ExecuteEvent(State, data.EventName, data.Params); |
714 | 738 | ||
739 | MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start; | ||
740 | |||
715 | m_InEvent = false; | 741 | m_InEvent = false; |
716 | m_CurrentEvent = String.Empty; | 742 | m_CurrentEvent = String.Empty; |
717 | 743 | ||
@@ -720,7 +746,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
720 | // This will be the very first event we deliver | 746 | // This will be the very first event we deliver |
721 | // (state_entry) in default state | 747 | // (state_entry) in default state |
722 | // | 748 | // |
723 | |||
724 | SaveState(m_Assembly); | 749 | SaveState(m_Assembly); |
725 | 750 | ||
726 | m_SaveState = false; | 751 | m_SaveState = false; |