diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | 67 |
1 files changed, 66 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs index 3fd1f5e..6f3a084 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -4045,7 +4045,72 @@ namespace OpenSim.Region.Framework.Scenes | |||
4045 | for (int i = 0; i < parts.Length; i++) | 4045 | for (int i = 0; i < parts.Length; i++) |
4046 | parts[i].TriggerScriptChangedEvent(val); | 4046 | parts[i].TriggerScriptChangedEvent(val); |
4047 | } | 4047 | } |
4048 | 4048 | ||
4049 | /// <summary> | ||
4050 | /// Returns a count of the number of scripts in this groups parts. | ||
4051 | /// </summary> | ||
4052 | public int ScriptCount() | ||
4053 | { | ||
4054 | int count = 0; | ||
4055 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4056 | for (int i = 0; i < parts.Length; i++) | ||
4057 | count += parts[i].Inventory.ScriptCount(); | ||
4058 | |||
4059 | return count; | ||
4060 | } | ||
4061 | |||
4062 | /// <summary> | ||
4063 | /// A float the value is a representative execution time in milliseconds of all scripts in the link set. | ||
4064 | /// </summary> | ||
4065 | public float ScriptExecutionTime() | ||
4066 | { | ||
4067 | IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>(); | ||
4068 | |||
4069 | if (engines.Length == 0) // No engine at all | ||
4070 | return 0.0f; | ||
4071 | |||
4072 | float time = 0.0f; | ||
4073 | |||
4074 | // get all the scripts in all parts | ||
4075 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4076 | List<TaskInventoryItem> scripts = new List<TaskInventoryItem>(); | ||
4077 | for (int i = 0; i < parts.Length; i++) | ||
4078 | { | ||
4079 | scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); | ||
4080 | } | ||
4081 | // extract the UUIDs | ||
4082 | List<UUID> ids = new List<UUID>(scripts.Count); | ||
4083 | foreach (TaskInventoryItem script in scripts) | ||
4084 | { | ||
4085 | if (!ids.Contains(script.ItemID)) | ||
4086 | { | ||
4087 | ids.Add(script.ItemID); | ||
4088 | } | ||
4089 | } | ||
4090 | // Offer the list of script UUIDs to each engine found and accumulate the time | ||
4091 | foreach (IScriptModule e in engines) | ||
4092 | { | ||
4093 | if (e != null) | ||
4094 | { | ||
4095 | time += e.GetScriptExecutionTime(ids); | ||
4096 | } | ||
4097 | } | ||
4098 | return time; | ||
4099 | } | ||
4100 | |||
4101 | /// <summary> | ||
4102 | /// Returns a count of the number of running scripts in this groups parts. | ||
4103 | /// </summary> | ||
4104 | public int RunningScriptCount() | ||
4105 | { | ||
4106 | int count = 0; | ||
4107 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
4108 | for (int i = 0; i < parts.Length; i++) | ||
4109 | count += parts[i].Inventory.RunningScriptCount(); | ||
4110 | |||
4111 | return count; | ||
4112 | } | ||
4113 | |||
4049 | public override string ToString() | 4114 | public override string ToString() |
4050 | { | 4115 | { |
4051 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); | 4116 | return String.Format("{0} {1} ({2})", Name, UUID, AbsolutePosition); |