diff options
author | Justin Clark-Casey (justincc) | 2012-04-13 22:34:36 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-04-13 22:34:36 +0100 |
commit | 1ad3fdb40ba86c6d0bcb9b06b5bb05004f670657 (patch) | |
tree | ccbd97c7ed18a0e6b9c5e6c771c6d7a2fca097e9 /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | Remove hardcoded god requirement from osSetRegionWaterHeight, osSetRegionSunS... (diff) | |
parent | Mantis 55025 Implement script time. (diff) | |
download | opensim-SC_OLD-1ad3fdb40ba86c6d0bcb9b06b5bb05004f670657.zip opensim-SC_OLD-1ad3fdb40ba86c6d0bcb9b06b5bb05004f670657.tar.gz opensim-SC_OLD-1ad3fdb40ba86c6d0bcb9b06b5bb05004f670657.tar.bz2 opensim-SC_OLD-1ad3fdb40ba86c6d0bcb9b06b5bb05004f670657.tar.xz |
Merge branch 'master' of ssh://opensimulator.org/var/git/opensim
Diffstat (limited to '')
-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 7d14814..a49ed13 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |||
@@ -3270,6 +3270,45 @@ namespace OpenSim.Region.Framework.Scenes | |||
3270 | } | 3270 | } |
3271 | 3271 | ||
3272 | /// <summary> | 3272 | /// <summary> |
3273 | /// A float the value is a representative execution time in milliseconds of all scripts in the link set. | ||
3274 | /// </summary> | ||
3275 | public float ScriptExecutionTime() | ||
3276 | { | ||
3277 | IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>(); | ||
3278 | |||
3279 | if (engines.Length == 0) // No engine at all | ||
3280 | return 0.0f; | ||
3281 | |||
3282 | float time = 0.0f; | ||
3283 | |||
3284 | // get all the scripts in all parts | ||
3285 | SceneObjectPart[] parts = m_parts.GetArray(); | ||
3286 | List<TaskInventoryItem> scripts = new List<TaskInventoryItem>(); | ||
3287 | for (int i = 0; i < parts.Length; i++) | ||
3288 | { | ||
3289 | scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL)); | ||
3290 | } | ||
3291 | // extract the UUIDs | ||
3292 | List<UUID> ids = new List<UUID>(scripts.Count); | ||
3293 | foreach (TaskInventoryItem script in scripts) | ||
3294 | { | ||
3295 | if (!ids.Contains(script.ItemID)) | ||
3296 | { | ||
3297 | ids.Add(script.ItemID); | ||
3298 | } | ||
3299 | } | ||
3300 | // Offer the list of script UUIDs to each engine found and accumulate the time | ||
3301 | foreach (IScriptModule e in engines) | ||
3302 | { | ||
3303 | if (e != null) | ||
3304 | { | ||
3305 | time += e.GetScriptExecutionTime(ids); | ||
3306 | } | ||
3307 | } | ||
3308 | return time; | ||
3309 | } | ||
3310 | |||
3311 | /// <summary> | ||
3273 | /// Returns a count of the number of running scripts in this groups parts. | 3312 | /// Returns a count of the number of running scripts in this groups parts. |
3274 | /// </summary> | 3313 | /// </summary> |
3275 | public int RunningScriptCount() | 3314 | public int RunningScriptCount() |