diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs index bae66e8..05dea5d 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | |||
@@ -51,6 +51,7 @@ using OpenSim.Region.ScriptEngine.Shared.Api.Runtime; | |||
51 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 51 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
52 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 52 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
53 | using OpenSim.Region.ScriptEngine.Interfaces; | 53 | using OpenSim.Region.ScriptEngine.Interfaces; |
54 | using System.Diagnostics; | ||
54 | 55 | ||
55 | namespace OpenSim.Region.ScriptEngine.Shared.Instance | 56 | namespace OpenSim.Region.ScriptEngine.Shared.Instance |
56 | { | 57 | { |
@@ -202,7 +203,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
202 | 203 | ||
203 | public long MeasurementPeriodExecutionTime { get; private set; } | 204 | public long MeasurementPeriodExecutionTime { get; private set; } |
204 | 205 | ||
205 | public static readonly long MaxMeasurementPeriod = 30 * (TimeSpan.TicksPerMinute / TimeSpan.TicksPerMillisecond); | 206 | public static readonly int MaxMeasurementPeriod = 30 * 1000; // show the *recent* time used by the script, to find currently active scripts |
206 | 207 | ||
207 | private bool m_coopTermination; | 208 | private bool m_coopTermination; |
208 | 209 | ||
@@ -831,15 +832,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance | |||
831 | m_EventStart = DateTime.Now; | 832 | m_EventStart = DateTime.Now; |
832 | m_InEvent = true; | 833 | m_InEvent = true; |
833 | 834 | ||
834 | int start = Util.EnvironmentTickCount(); | ||
835 | |||
836 | // Reset the measurement period when we reach the end of the current one. | 835 | // Reset the measurement period when we reach the end of the current one. |
837 | if (start - MeasurementPeriodTickStart > MaxMeasurementPeriod) | 836 | if (Util.EnvironmentTickCountSubtract((int)MeasurementPeriodTickStart) > MaxMeasurementPeriod) |
838 | MeasurementPeriodTickStart = start; | 837 | { |
838 | MeasurementPeriodTickStart = Util.EnvironmentTickCount(); | ||
839 | MeasurementPeriodExecutionTime = 0; | ||
840 | } | ||
839 | 841 | ||
842 | Stopwatch executionTime = new Stopwatch(); | ||
843 | executionTime.Start(); | ||
844 | |||
840 | m_Script.ExecuteEvent(State, data.EventName, data.Params); | 845 | m_Script.ExecuteEvent(State, data.EventName, data.Params); |
841 | 846 | ||
842 | MeasurementPeriodExecutionTime += Util.EnvironmentTickCount() - start; | 847 | executionTime.Stop(); |
848 | MeasurementPeriodExecutionTime += executionTime.ElapsedMilliseconds; | ||
843 | 849 | ||
844 | m_InEvent = false; | 850 | m_InEvent = false; |
845 | m_CurrentEvent = String.Empty; | 851 | m_CurrentEvent = String.Empty; |