* Added Active Scripts to report the number of scripts running to Sim Stats

* Added Script Performance to report the number of functions run per second to Sim Stats.
* Removed a few warnings (@.@ up to 50 now)
ThreadPoolClientBranch
Teravus Ovares 2008-02-06 08:03:22 +00:00
parent 355d0fdb95
commit 9cd9e90e7f
8 changed files with 441 additions and 13 deletions

View File

@ -1051,7 +1051,7 @@ namespace OpenSim.Region.Communications.OGS1
NoteDeadRegion(regionHandle);
return false;
}
catch (RemotingException e)
catch (RemotingException)
{
NoteDeadRegion(regionHandle);
m_log.Warn("Remoting Error: Unable to connect to adjacent region to tell it to close child agents: " + regInfo.RegionName +

View File

@ -67,6 +67,9 @@ namespace OpenSim.Region.Environment.Scenes
protected int m_numChildAgents = 0;
protected int m_physicalPrim = 0;
protected int m_activeScripts = 0;
protected int m_scriptLPS = 0;
internal object m_syncRoot = new object();
public PhysicsScene _PhyScene;
@ -201,6 +204,16 @@ namespace OpenSim.Region.Environment.Scenes
m_physicalPrim--;
}
public void AddToScriptLPS(int number)
{
m_scriptLPS += number;
}
public void AddActiveScripts(int number)
{
m_activeScripts += number;
}
public void RemovePrim(uint localID, LLUUID avatar_deleter)
{
List<EntityBase> EntityList = GetEntities();
@ -322,6 +335,17 @@ namespace OpenSim.Region.Environment.Scenes
return m_physicalPrim;
}
public int GetActiveScripts()
{
return m_activeScripts;
}
public int GetScriptLPS()
{
int returnval = m_scriptLPS;
m_scriptLPS = 0;
return returnval;
}
#endregion
#region Get Methods
@ -546,10 +570,6 @@ namespace OpenSim.Region.Environment.Scenes
//m_log.Info("[DISTANCE]: " + distResult.ToString());
if (distResult > 60)
{
int x = 0;
}
if (distResult < presence.DrawDistance)
{
// Send Only if we don't already know about it.

View File

@ -639,6 +639,8 @@ namespace OpenSim.Region.Environment.Scenes
m_statsReporter.addFrameMS(frameMS);
m_statsReporter.addPhysicsMS(physicsMS);
m_statsReporter.addOtherMS(otherMS);
m_statsReporter.SetActiveScripts(m_innerScene.GetActiveScripts());
m_statsReporter.addScriptLines(m_innerScene.GetScriptLPS());
}
catch (NotImplementedException)

View File

@ -94,6 +94,17 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void StopScripts()
{
lock (m_parts)
{
foreach (SceneObjectPart part in m_parts.Values)
{
part.StopScripts();
}
}
}
/// Start a given script.
/// </summary>
/// <param name="localID">

View File

@ -1702,6 +1702,18 @@ namespace OpenSim.Region.Environment.Scenes
m_parts.Clear();
}
public void AddScriptLPS(int count)
{
InnerScene d = m_scene.m_innerScene;
d.AddToScriptLPS(count);
}
public void AddActiveScriptCount(int count)
{
InnerScene d = m_scene.m_innerScene;
d.AddActiveScripts(count);
}
public override void SetText(string text, Vector3 color, double alpha)
{
Color = Color.FromArgb(0xff - (int) (alpha*0xff),

View File

@ -126,6 +126,20 @@ namespace OpenSim.Region.Environment.Scenes
}
}
public void StopScripts()
{
lock (m_taskInventory)
{
foreach (TaskInventoryItem item in m_taskInventory.Values)
{
if (10 == item.Type)
{
StopScript(item.ItemID);
}
}
}
}
/// <summary>
/// Start a script which is in this prim's inventory.
/// </summary>
@ -144,6 +158,7 @@ namespace OpenSim.Region.Environment.Scenes
{
string script = Helpers.FieldToUTF8String(rezAsset.Data);
m_parentGroup.Scene.EventManager.TriggerRezScript(LocalID, item.ItemID, script);
}
else
{
@ -167,6 +182,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_taskInventory.ContainsKey(itemId))
{
StartScript(m_taskInventory[itemId]);
m_parentGroup.AddActiveScriptCount(1);
}
else
{
@ -187,6 +203,7 @@ namespace OpenSim.Region.Environment.Scenes
if (m_taskInventory.ContainsKey(itemId))
{
m_parentGroup.Scene.EventManager.TriggerRemoveScript(LocalID, itemId);
m_parentGroup.AddActiveScriptCount(-1);
}
else
{
@ -295,6 +312,11 @@ namespace OpenSim.Region.Environment.Scenes
return false;
}
public void AddScriptLPS(int count)
{
m_parentGroup.AddScriptLPS(count);
}
/// <summary>
/// Remove an item from this prim's inventory
/// </summary>

View File

@ -51,10 +51,13 @@ namespace OpenSim.Region.Environment.Scenes
PhysicsMS = 7,
AgentMS = 8,
ImageMS = 9,
ScriptMS = 10,
TotalPrim = 11,
ActivePrim = 12,
Agents = 13,
ChildAgents = 14,
ActiveScripts = 15,
ScriptLinesPerSecond = 16,
InPacketsPerSecond = 17,
OutPacketsPerSecond = 18,
PendingDownloads = 19,
@ -74,12 +77,15 @@ namespace OpenSim.Region.Environment.Scenes
private int m_fps = 0;
private float m_pfps = 0;
private int m_agentUpdates = 0;
private int m_frameMS = 0;
private int m_netMS = 0;
private int m_agentMS = 0;
private int m_physicsMS = 0;
private int m_imageMS = 0;
private int m_otherMS = 0;
private int m_scriptMS = 0;
private int m_rootAgents = 0;
private int m_childAgents = 0;
private int m_numPrim = 0;
@ -89,9 +95,11 @@ namespace OpenSim.Region.Environment.Scenes
private int m_unAckedBytes = 0;
private int m_pendingDownloads = 0;
private int m_pendingUploads = 0;
private int m_activeScripts = 0;
private int m_scriptLinesPerSecond = 0;
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[19];
SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats);
@ -106,7 +114,7 @@ namespace OpenSim.Region.Environment.Scenes
statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
ReportingRegion = regionData;
for (int i = 0; i<19;i++)
for (int i = 0; i<21;i++)
{
sb[i] = new SimStatsPacket.StatBlock();
}
@ -222,6 +230,12 @@ namespace OpenSim.Region.Environment.Scenes
sb[18].StatID = (uint)Stats.PendingUploads;
sb[18].StatValue = m_pendingUploads;
sb[19].StatID = (uint)Stats.ActiveScripts;
sb[19].StatValue = m_activeScripts;
sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
statpack.Stat = sb;
if (OnSendStatsResult != null)
@ -241,12 +255,15 @@ namespace OpenSim.Region.Environment.Scenes
m_inPacketsPerSecond = 0;
m_outPacketsPerSecond = 0;
m_unAckedBytes = 0;
m_scriptLinesPerSecond = 0;
m_frameMS = 0;
m_agentMS = 0;
m_netMS = 0;
m_physicsMS = 0;
m_imageMS = 0;
m_otherMS = 0;
m_scriptMS = 0;
}
# region methods called from Scene
@ -344,6 +361,16 @@ namespace OpenSim.Region.Environment.Scenes
m_pendingDownloads += count;
}
public void addScriptLines(int count)
{
m_scriptLinesPerSecond += count;
}
public void SetActiveScripts(int count)
{
m_activeScripts = count;
}
#endregion
}

File diff suppressed because it is too large Load Diff