* A hacky Top Scripts display. It isn't accurate as far as ms accounting, however you can use it to help find out what scripts are causing your simulator to cry.
* Access it from the Estate tools/Debug tab.0.6.0-stable
parent
76a3bde76e
commit
c20f7d6171
|
@ -5652,6 +5652,13 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|
||||||
handlerLandStatRequest(0, 1, 0, "", this);
|
handlerLandStatRequest(0, 1, 0, "", this);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "scripts":
|
||||||
|
handlerLandStatRequest = OnLandStatRequest;
|
||||||
|
if (handlerLandStatRequest != null)
|
||||||
|
{
|
||||||
|
handlerLandStatRequest(0, 0, 0, "", this);
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString());
|
m_log.Error("EstateOwnerMessage: Unknown method requested\n" + messagePacket.ToString());
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -313,12 +313,21 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
|
||||||
}
|
}
|
||||||
private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
|
private void HandleLandStatRequest(int parcelID, uint reportType, uint requestFlags, string filter, IClientAPI remoteClient)
|
||||||
{
|
{
|
||||||
Dictionary<uint, float> colliders = m_scene.PhysicsScene.GetTopColliders();
|
Dictionary<uint, float> SceneData = new Dictionary<uint,float>();
|
||||||
|
|
||||||
List<LandStatReportItem> collidera = new List<LandStatReportItem>();
|
if (reportType == 1)
|
||||||
lock (colliders)
|
|
||||||
{
|
{
|
||||||
foreach (uint obj in colliders.Keys)
|
SceneData = m_scene.PhysicsScene.GetTopColliders();
|
||||||
|
}
|
||||||
|
else if (reportType == 0)
|
||||||
|
{
|
||||||
|
SceneData = m_scene.m_innerScene.GetTopScripts();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<LandStatReportItem> SceneReport = new List<LandStatReportItem>();
|
||||||
|
lock (SceneData)
|
||||||
|
{
|
||||||
|
foreach (uint obj in SceneData.Keys)
|
||||||
{
|
{
|
||||||
SceneObjectPart prt = m_scene.GetSceneObjectPart(obj);
|
SceneObjectPart prt = m_scene.GetSceneObjectPart(obj);
|
||||||
if (prt != null)
|
if (prt != null)
|
||||||
|
@ -332,21 +341,30 @@ namespace OpenSim.Region.Environment.Modules.World.Estate
|
||||||
lsri.LocationX = sog.AbsolutePosition.X;
|
lsri.LocationX = sog.AbsolutePosition.X;
|
||||||
lsri.LocationY = sog.AbsolutePosition.Y;
|
lsri.LocationY = sog.AbsolutePosition.Y;
|
||||||
lsri.LocationZ = sog.AbsolutePosition.Z;
|
lsri.LocationZ = sog.AbsolutePosition.Z;
|
||||||
lsri.Score = colliders[obj];
|
lsri.Score = SceneData[obj];
|
||||||
lsri.TaskID = sog.UUID;
|
lsri.TaskID = sog.UUID;
|
||||||
lsri.TaskLocalID = sog.LocalId;
|
lsri.TaskLocalID = sog.LocalId;
|
||||||
lsri.TaskName = sog.GetPartName(obj);
|
lsri.TaskName = sog.GetPartName(obj);
|
||||||
lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID);
|
lsri.OwnerName = m_scene.CommsManager.UUIDNameRequestString(sog.OwnerID);
|
||||||
|
if (filter.Length != 0)
|
||||||
|
{
|
||||||
|
if ((lsri.OwnerName.Contains(filter) || lsri.TaskName.Contains(filter)))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
collidera.Add(lsri);
|
SceneReport.Add(lsri);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)collidera.Count,collidera.ToArray());
|
remoteClient.SendLandStatReply(reportType, requestFlags, (uint)SceneReport.Count,SceneReport.ToArray());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,6 +174,9 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public event AvatarKillData OnAvatarKilled;
|
public event AvatarKillData OnAvatarKilled;
|
||||||
|
|
||||||
|
public delegate void ScriptTimerEvent(uint localID, double timerinterval);
|
||||||
|
|
||||||
|
public event ScriptTimerEvent OnScriptTimerEvent;
|
||||||
|
|
||||||
|
|
||||||
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
|
public delegate void ObjectBeingRemovedFromScene(SceneObjectGroup obj);
|
||||||
|
@ -332,6 +335,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
|
private RequestParcelPrimCountUpdate handlerRequestParcelPrimCountUpdate = null;
|
||||||
private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
|
private ParcelPrimCountTainted handlerParcelPrimCountTainted = null;
|
||||||
private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
|
private ObjectBeingRemovedFromScene handlerObjectBeingRemovedFromScene = null;
|
||||||
|
private ScriptTimerEvent handlerScriptTimerEvent = null;
|
||||||
|
|
||||||
public void TriggerOnScriptChangedEvent(uint localID, uint change)
|
public void TriggerOnScriptChangedEvent(uint localID, uint change)
|
||||||
{
|
{
|
||||||
|
@ -755,5 +759,16 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// this lets us keep track of nasty script events like timer, etc.
|
||||||
|
public void TriggerTimerEvent(uint objLocalID, double Interval)
|
||||||
|
{
|
||||||
|
handlerScriptTimerEvent = OnScriptTimerEvent;
|
||||||
|
if (handlerScriptTimerEvent != null)
|
||||||
|
{
|
||||||
|
handlerScriptTimerEvent(objLocalID, Interval);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -846,6 +846,37 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Dictionary<uint, float> GetTopScripts()
|
||||||
|
{
|
||||||
|
Dictionary<uint, float> topScripts = new Dictionary<uint, float>();
|
||||||
|
|
||||||
|
List<EntityBase> EntityList = GetEntities();
|
||||||
|
int limit = 0;
|
||||||
|
foreach (EntityBase ent in EntityList)
|
||||||
|
{
|
||||||
|
if (ent is SceneObjectGroup)
|
||||||
|
{
|
||||||
|
SceneObjectGroup grp = (SceneObjectGroup)ent;
|
||||||
|
if ((grp.RootPart.GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Scripted) != 0)
|
||||||
|
{
|
||||||
|
if (grp.scriptScore >= 0.01)
|
||||||
|
{
|
||||||
|
topScripts.Add(grp.LocalId, grp.scriptScore);
|
||||||
|
limit++;
|
||||||
|
if (limit >= 100)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
grp.scriptScore = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return topScripts;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Other Methods
|
#region Other Methods
|
||||||
|
|
|
@ -90,6 +90,7 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
/// since the group's last persistent backup
|
/// since the group's last persistent backup
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool HasGroupChanged = false;
|
public bool HasGroupChanged = false;
|
||||||
|
public float scriptScore = 0f;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -959,6 +960,10 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
|
|
||||||
public void AddScriptLPS(int count)
|
public void AddScriptLPS(int count)
|
||||||
{
|
{
|
||||||
|
if (scriptScore + count >= float.MaxValue - count)
|
||||||
|
scriptScore = 0;
|
||||||
|
|
||||||
|
scriptScore += (float)count;
|
||||||
InnerScene d = m_scene.m_innerScene;
|
InnerScene d = m_scene.m_innerScene;
|
||||||
d.AddToScriptLPS(count);
|
d.AddToScriptLPS(count);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2752,6 +2752,14 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
PhysActor.OnCollisionUpdate -= PhysicsCollision;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ((GetEffectiveObjectFlags() & (uint)LLObject.ObjectFlags.Scripted) != 0)
|
||||||
|
{
|
||||||
|
m_parentGroup.Scene.EventManager.OnScriptTimerEvent += handleTimerAccounting;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_parentGroup.Scene.EventManager.OnScriptTimerEvent -= handleTimerAccounting;
|
||||||
|
}
|
||||||
|
|
||||||
LocalFlags=(LLObject.ObjectFlags)objectflagupdate;
|
LocalFlags=(LLObject.ObjectFlags)objectflagupdate;
|
||||||
|
|
||||||
|
@ -2812,6 +2820,30 @@ namespace OpenSim.Region.Environment.Scenes
|
||||||
GetProperties(client);
|
GetProperties(client);
|
||||||
m_updateFlag = 2;
|
m_updateFlag = 2;
|
||||||
}
|
}
|
||||||
|
private void handleTimerAccounting(uint localID, double interval)
|
||||||
|
{
|
||||||
|
if (localID == LocalId)
|
||||||
|
{
|
||||||
|
|
||||||
|
float sec = (float)interval;
|
||||||
|
if (m_parentGroup != null)
|
||||||
|
{
|
||||||
|
if (sec == 0)
|
||||||
|
{
|
||||||
|
if (m_parentGroup.scriptScore + 0.001f >= float.MaxValue - 0.001)
|
||||||
|
m_parentGroup.scriptScore = 0;
|
||||||
|
|
||||||
|
m_parentGroup.scriptScore += 0.001f;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_parentGroup.scriptScore + (0.001f / sec) >= float.MaxValue - (0.001f / sec))
|
||||||
|
m_parentGroup.scriptScore = 0;
|
||||||
|
m_parentGroup.scriptScore += (0.001f / sec);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -474,7 +474,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
|
|
||||||
public void llSensor(string name, string id, int type, double range, double arc)
|
public void llSensor(string name, string id, int type, double range, double arc)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(300);
|
||||||
LLUUID keyID = LLUUID.Zero;
|
LLUUID keyID = LLUUID.Zero;
|
||||||
LLUUID.TryParse(id, out keyID);
|
LLUUID.TryParse(id, out keyID);
|
||||||
|
|
||||||
|
@ -1818,7 +1818,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
|
|
||||||
public void llSleep(double sec)
|
public void llSleep(double sec)
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS((int)(sec * 100));
|
||||||
Thread.Sleep((int)(sec * 1000));
|
Thread.Sleep((int)(sec * 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2582,7 +2582,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
|
|
||||||
public void llResetScript()
|
public void llResetScript()
|
||||||
{
|
{
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(800);
|
||||||
m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
|
m_ScriptEngine.m_ScriptManager.ResetScript(m_localID, m_itemID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4279,7 +4279,7 @@ namespace OpenSim.Region.ScriptEngine.Common
|
||||||
ScriptManager sm;
|
ScriptManager sm;
|
||||||
IScript script = null;
|
IScript script = null;
|
||||||
|
|
||||||
m_host.AddScriptLPS(1);
|
m_host.AddScriptLPS(8000);
|
||||||
|
|
||||||
// These functions are supposed to be robust,
|
// These functions are supposed to be robust,
|
||||||
// so get the state one step at a time.
|
// so get the state one step at a time.
|
||||||
|
|
|
@ -316,6 +316,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
|
||||||
m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "sensor", EventQueueManager.llDetectNull,
|
m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "sensor", EventQueueManager.llDetectNull,
|
||||||
new object[] { new LSL_Types.LSLInteger(SensedObjects.Length) });
|
new object[] { new LSL_Types.LSLInteger(SensedObjects.Length) });
|
||||||
}
|
}
|
||||||
|
m_CmdManager.m_ScriptEngine.World.EventManager.TriggerTimerEvent(ts.localID, ts.interval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,6 +126,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.AsyncCommandPlugin
|
||||||
// Add it to queue
|
// Add it to queue
|
||||||
m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", EventQueueManager.llDetectNull,
|
m_CmdManager.m_ScriptEngine.m_EventQueueManager.AddToScriptQueue(ts.localID, ts.itemID, "timer", EventQueueManager.llDetectNull,
|
||||||
null);
|
null);
|
||||||
|
m_CmdManager.m_ScriptEngine.World.EventManager.TriggerTimerEvent(ts.localID, ((double)ts.interval / 10000000));
|
||||||
// set next interval
|
// set next interval
|
||||||
|
|
||||||
//ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
|
//ts.next = DateTime.Now.ToUniversalTime().AddSeconds(ts.interval);
|
||||||
|
|
Loading…
Reference in New Issue