From c20f7d6171a9df151c3ccde063336338da9ae322 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 25 May 2008 20:50:45 +0000 Subject: * A hacky Top Scripts display. It isn't accurate as far as ms accounting, however you can use it to help find out what scripts are causing your simulator to cry. * Access it from the Estate tools/Debug tab. --- .../Region/Environment/Scenes/SceneObjectPart.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'OpenSim/Region/Environment/Scenes/SceneObjectPart.cs') diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index b724bda..c6b3059 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -2752,6 +2752,14 @@ namespace OpenSim.Region.Environment.Scenes PhysActor.OnCollisionUpdate -= PhysicsCollision; } } + if ((GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Scripted) != 0) + { + m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting; + } + else + { + m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting; + } LocalFlags=(LLObject.ObjectFlags)objectflagupdate; @@ -2812,6 +2820,30 @@ namespace OpenSim.Region.Environment.Scenes GetProperties(client); m_updateFlag = 2; } + private void handleTimerAccounting(uint localID, double interval) + { + if (localID == LocalId) + { + + float sec = (float)interval; + if (m_parentGroup != null) + { + if (sec == 0) + { + if (m_parentGroup.scriptScore + 0.001f >= float.MaxValue - 0.001) + m_parentGroup.scriptScore = 0; + + m_parentGroup.scriptScore += 0.001f; + return; + } + + if (m_parentGroup.scriptScore + (0.001f / sec) >= float.MaxValue - (0.001f / sec)) + m_parentGroup.scriptScore = 0; + m_parentGroup.scriptScore += (0.001f / sec); + } + + } + } } } -- cgit v1.1