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)
@ -825,8 +842,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
if (Engine.World.PipeEventsForScript(LocalID) ||
data.EventName == "control") // Don't freeze avies!
{
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// PrimName, ScriptName, data.EventName, State);
// m_log.DebugFormat("[Script] Delivered event {2} in state {3} to {0}.{1}",
// PrimName, ScriptName, data.EventName, State);
try
{
@ -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)
{
@ -857,12 +873,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
}
catch (Exception e)
{
// m_log.DebugFormat(
// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
// ScriptName, ItemID, e.Message, e.StackTrace);
m_InEvent = false;
m_CurrentEvent = String.Empty;
// m_log.DebugFormat(
// "[SCRIPT] Exception in script {0} {1}: {2}{3}",
// ScriptName, ItemID, e.Message, e.StackTrace);
if ((!(e is TargetInvocationException)
|| (!(e.InnerException is SelfDeleteException)
@ -955,7 +968,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
return 0;
}
}
public int EventTime()
{