From a74408d1d280097c17e5ec9b4417df4e54586a4c Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 16 Mar 2012 01:31:53 +0000
Subject: Aggregate script execution times by linksets rather than individual
prims.
This is for the top scripts report.
---
OpenSim/Region/Framework/Interfaces/IScriptModule.cs | 5 ++++-
OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs | 11 +++++++++++
OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs | 6 ++++++
OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 5 ++---
4 files changed, 23 insertions(+), 4 deletions(-)
(limited to 'OpenSim/Region')
diff --git a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
index 9fb4a25..9cab2e1 100644
--- a/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
+++ b/OpenSim/Region/Framework/Interfaces/IScriptModule.cs
@@ -79,7 +79,10 @@ namespace OpenSim.Region.Framework.Interfaces
///
/// Get the execution times of all scripts in each object.
///
- /// A dictionary where the key is a local object ID and the value is an execution time in milliseconds.
+ ///
+ /// A dictionary where the key is the root object ID of a linkset
+ /// and the value is a representative execution time in milliseconds of all scripts in that linkset.
+ ///
Dictionary GetObjectScriptsExecutionTimes();
}
}
\ No newline at end of file
diff --git a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
index 11f54a2..b04f6b6 100644
--- a/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Interfaces/IScriptInstance.cs
@@ -99,6 +99,17 @@ namespace OpenSim.Region.ScriptEngine.Interfaces
string ScriptName { get; }
UUID ItemID { get; }
UUID ObjectID { get; }
+
+ ///
+ /// UUID of the root object for the linkset that the script is in.
+ ///
+ UUID RootObjectID { get; }
+
+ ///
+ /// Local id of the root object for the linkset that the script is in.
+ ///
+ uint RootLocalID { get; }
+
uint LocalID { get; }
UUID AssetID { get; }
Queue EventQueue { get; }
diff --git a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
index b177287..6e36742 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Instance/ScriptInstance.cs
@@ -164,6 +164,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
public uint LocalID { get; private set; }
+ public UUID RootObjectID { get; private set; }
+
+ public uint RootLocalID { get; private set; }
+
public UUID AssetID { get; private set; }
public Queue EventQueue { get; private set; }
@@ -198,6 +202,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Instance
Engine = engine;
LocalID = part.LocalId;
ObjectID = part.UUID;
+ RootLocalID = part.ParentGroup.LocalId;
+ RootObjectID = part.ParentGroup.UUID;
ItemID = itemID;
AssetID = assetID;
PrimName = primName;
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 9214942..5a6b872 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -1083,7 +1083,6 @@ namespace OpenSim.Region.ScriptEngine.XEngine
if (!m_PrimObjects[localID].Contains(itemID))
m_PrimObjects[localID].Add(itemID);
-
}
if (!m_Assemblies.ContainsKey(assetID))
@@ -1901,7 +1900,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
foreach (IScriptInstance si in m_Scripts.Values)
{
if (!topScripts.ContainsKey(si.LocalID))
- topScripts[si.LocalID] = 0;
+ topScripts[si.RootLocalID] = 0;
// long ticksElapsed = tickNow - si.MeasurementPeriodTickStart;
// float framesElapsed = ticksElapsed / (18.1818 * TimeSpan.TicksPerMillisecond);
@@ -1937,7 +1936,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
float adjustedExecutionTime
= ((float)si.MeasurementPeriodExecutionTime / ticksElapsed) * 18.1818f;
- topScripts[si.LocalID] += adjustedExecutionTime;
+ topScripts[si.RootLocalID] += adjustedExecutionTime;
}
}
--
cgit v1.1