diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 5786f48..ced3fb5 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -4032,6 +4032,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
4032 | } | 4032 | } |
4033 | 4033 | ||
4034 | /// <summary> | 4034 | /// <summary> |
4035 | /// A float the value is a representative execution time in milliseconds of all scripts in the link set. | ||
4036 | /// </summary> | ||
4037 | public float ScriptExecutionTime() | ||
4038 | { | ||
4039 | IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>(); | ||
4040 | |||
4041 | if (engines.Length == 0) // No engine at all | ||
4042 | return 0.0f; | ||
4043 | |||
4044 | float time = 0.0f; | ||
4045 | |||
4046 | // get all the scripts in all parts | ||
4047 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4048 | List<TaskInventoryItem> scripts = new List<TaskInventoryItem>(); | ||
4049 | for (int i = 0; i < parts.Length; i++) | ||
4050 | { | ||
4051 | scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); | ||
4052 | } | ||
4053 | // extract the UUIDs | ||
4054 | List<UUID> ids = new List<UUID>(scripts.Count); | ||
4055 | foreach (TaskInventoryItem script in scripts) | ||
4056 | { | ||
4057 | if (!ids.Contains(script.ItemID)) | ||
4058 | { | ||
4059 | ids.Add(script.ItemID); | ||
4060 | } | ||
4061 | } | ||
4062 | // Offer the list of script UUIDs to each engine found and accumulate the time | ||
4063 | foreach (IScriptModule e in engines) | ||
4064 | { | ||
4065 | if (e != null) | ||
4066 | { | ||
4067 | time += e.GetScriptExecutionTime(ids); | ||
4068 | } | ||
4069 | } | ||
4070 | return time; | ||
4071 | } | ||
4072 | |||
4073 | /// <summary> | ||
4035 | /// Returns a count of the number of running scripts in this groups parts. | 4074 | /// Returns a count of the number of running scripts in this groups parts. |
4036 | /// </summary> | 4075 | /// </summary> |
4037 | public int RunningScriptCount() | 4076 | public int RunningScriptCount() |