Changed "Script Execution Time" to be the gross time, i.e. including handling it in XEngine

Previously the "Net Time" was reported: only the time actually spent in the script's code. This is not a correct indication of how much load the script places on the simulator, because scripts that change state often or have many events use up a lot of time just in the event handlers, and previously this time wasn't counted.
0.8.2-post-fixes
Oren Hurvitz 2015-07-27 12:34:09 +03:00
parent a3bed1fbcb
commit 5679cd0100
1 changed files with 198 additions and 186 deletions

View File

@ -753,6 +753,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (Suspended)
return 0;
Stopwatch timer = new Stopwatch();
timer.Start();
try
{
return EventProcessorInt();
}
finally
{
timer.Stop();
ExecutionTime.AddSample(timer);
}
}
}
private object EventProcessorInt()
{
EventParams data = null;
lock (EventQueue)
@ -834,16 +851,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
m_EventStart = DateTime.Now;
m_InEvent = true;
Stopwatch timer = new Stopwatch();
timer.Start();
try
{
m_Script.ExecuteEvent(State, data.EventName, data.Params);
timer.Stop();
ExecutionTime.AddSample(timer);
}
finally
{
m_InEvent = false;
m_CurrentEvent = String.Empty;
}
if (m_SaveState)
{
@ -861,9 +877,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
// ScriptName, ItemID, e.Message, e.StackTrace);
m_InEvent = false;
m_CurrentEvent = String.Empty;
if ((!(e is TargetInvocationException)
|| (!(e.InnerException is SelfDeleteException)
&& !(e.InnerException is ScriptDeleteException)
@ -955,7 +968,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
return 0;
}
}
public int EventTime()
{