mirror of
https://github.com/opensim/opensim.git
synced 2026-08-12 12:25:42 +08:00
Mantis 55025 Implement script time.
Signed-off-by: nebadon <michael@osgrid.org>
This commit is contained in:
@@ -3269,6 +3269,45 @@ namespace OpenSim.Region.Framework.Scenes
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A float the value is a representative execution time in milliseconds of all scripts in the link set.
|
||||
/// </summary>
|
||||
public float ScriptExecutionTime()
|
||||
{
|
||||
IScriptModule[] engines = Scene.RequestModuleInterfaces<IScriptModule>();
|
||||
|
||||
if (engines.Length == 0) // No engine at all
|
||||
return 0.0f;
|
||||
|
||||
float time = 0.0f;
|
||||
|
||||
// get all the scripts in all parts
|
||||
SceneObjectPart[] parts = m_parts.GetArray();
|
||||
List<TaskInventoryItem> scripts = new List<TaskInventoryItem>();
|
||||
for (int i = 0; i < parts.Length; i++)
|
||||
{
|
||||
scripts.AddRange(parts[i].Inventory.GetInventoryItems(InventoryType.LSL));
|
||||
}
|
||||
// extract the UUIDs
|
||||
List<UUID> ids = new List<UUID>(scripts.Count);
|
||||
foreach (TaskInventoryItem script in scripts)
|
||||
{
|
||||
if (!ids.Contains(script.ItemID))
|
||||
{
|
||||
ids.Add(script.ItemID);
|
||||
}
|
||||
}
|
||||
// Offer the list of script UUIDs to each engine found and accumulate the time
|
||||
foreach (IScriptModule e in engines)
|
||||
{
|
||||
if (e != null)
|
||||
{
|
||||
time += e.GetScriptExecutionTime(ids);
|
||||
}
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a count of the number of running scripts in this groups parts.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user