diff options
author | Talun | 2012-04-10 21:25:05 +0100 |
---|---|---|
committer | nebadon | 2012-04-12 18:44:00 -0700 |
commit | 08e509978d81cb3451c205ed59648e3f5da91344 (patch) | |
tree | e8fb382ef1661c2d370c64915a05376b295c551e /OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs | |
parent | make changes to FlotsamCache.ini.example as noted in mantis #5960 (diff) | |
download | opensim-SC-08e509978d81cb3451c205ed59648e3f5da91344.zip opensim-SC-08e509978d81cb3451c205ed59648e3f5da91344.tar.gz opensim-SC-08e509978d81cb3451c205ed59648e3f5da91344.tar.bz2 opensim-SC-08e509978d81cb3451c205ed59648e3f5da91344.tar.xz |
Mantis 55025 Implement script time.
Signed-off-by: nebadon <michael@osgrid.org>
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 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() |