From 7fdfeb58304d614970aa7c0010951ba5a8184e4b Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Fri, 14 Dec 2007 00:49:40 +0000 Subject: * Added Active(physical) object count to the SimStatsReporter --- OpenSim/Region/Environment/Scenes/InnerScene.cs | 15 +++++++++++++- OpenSim/Region/Environment/Scenes/Scene.cs | 12 +++++++++++ .../Region/Environment/Scenes/SceneObjectPart.cs | 5 +++++ .../Region/Environment/Scenes/SimStatsReporter.cs | 24 +++++++++++++++------- 4 files changed, 48 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Environment/Scenes') diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs index a7515f7..03f3cd0 100644 --- a/OpenSim/Region/Environment/Scenes/InnerScene.cs +++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs @@ -60,6 +60,7 @@ namespace OpenSim.Region.Environment.Scenes protected int m_numRootAgents = 0; protected int m_numPrim = 0; protected int m_numChildAgents = 0; + protected int m_physicalPrim = 0; internal object m_syncRoot = new object(); @@ -177,7 +178,14 @@ namespace OpenSim.Region.Environment.Scenes m_numPrim++; } } - + public void AddPhysicalPrim(int number) + { + m_physicalPrim++; + } + public void RemovePhysicalPrim(int number) + { + m_physicalPrim--; + } public void RemovePrim(uint localID, LLUUID avatar_deleter) { foreach (EntityBase obj in Entities.Values) @@ -287,6 +295,11 @@ namespace OpenSim.Region.Environment.Scenes return m_numPrim; } + public int GetActiveObjects() + { + return m_physicalPrim; + } + #endregion #region Get Methods diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index ea67ba3..59548a2 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs @@ -582,6 +582,7 @@ namespace OpenSim.Region.Environment.Scenes m_statsReporter.SetRootAgents(m_innerScene.GetRootAgentCount()); m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount()); m_statsReporter.SetObjects(m_innerScene.GetTotalObjects()); + m_statsReporter.SetActiveObjects(m_innerScene.GetActiveObjects()); } catch (NotImplementedException) @@ -1918,6 +1919,17 @@ namespace OpenSim.Region.Environment.Scenes { m_innerScene.SwapRootChildAgent(rootChildChildRootTF); } + + public void AddPhysicalPrim(int num) + { + m_innerScene.AddPhysicalPrim(num); + } + + public void RemovePhysicalPrim(int num) + { + m_innerScene.RemovePhysicalPrim(num); + } + /// /// /// diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs index 6bb00cb..f6c0ee3 100644 --- a/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Environment/Scenes/SceneObjectPart.cs @@ -1161,6 +1161,9 @@ namespace OpenSim.Region.Environment.Scenes if (PhysActor.IsPhysical) { + if (!isNew) + this.ParentGroup.m_scene.RemovePhysicalPrim(1); + PhysActor.OnRequestTerseUpdate -= PhysicsRequestingTerseUpdate; PhysActor.OnOutOfBounds -= PhysicsOutOfBounds; } @@ -1184,6 +1187,8 @@ namespace OpenSim.Region.Environment.Scenes //RotationOffset.Y, RotationOffset.Z), UsePhysics); if (UsePhysics) { + this.ParentGroup.m_scene.AddPhysicalPrim(1); + PhysActor.OnRequestTerseUpdate += PhysicsRequestingTerseUpdate; PhysActor.OnOutOfBounds += PhysicsOutOfBounds; } diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs index 9d9737a..15df619 100644 --- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs @@ -21,6 +21,7 @@ namespace OpenSim.Region.Environment.Scenes PhysicsFPS = 2, AgentUpdates = 3, TotalPrim = 11, + ActivePrim = 12, Agents = 13, ChildAgents = 14, InPacketsPerSecond = 17, @@ -38,6 +39,7 @@ namespace OpenSim.Region.Environment.Scenes private int m_numPrim = 0; private int m_inPacketsPerSecond = 0; private int m_outPacketsPerSecond = 0; + private int m_activePrim = 0; private int m_unAckedBytes = 0; private RegionInfo ReportingRegion; @@ -57,7 +59,7 @@ namespace OpenSim.Region.Environment.Scenes { m_report.Enabled = false; SimStatsPacket statpack = new SimStatsPacket(); - SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[10]; + SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[11]; statpack.Region = new SimStatsPacket.RegionBlock(); statpack.Region.RegionX = ReportingRegion.RegionLocX; statpack.Region.RegionY = ReportingRegion.RegionLocY; @@ -100,16 +102,20 @@ namespace OpenSim.Region.Environment.Scenes sb[6].StatValue = m_numPrim; sb[7] = new SimStatsPacket.StatBlock(); - sb[7].StatID = (uint)Stats.InPacketsPerSecond; - sb[7].StatValue = (int)(m_inPacketsPerSecond / statsUpdatesEveryMS); + sb[7].StatID = (uint)Stats.ActivePrim; + sb[7].StatValue = m_activePrim; sb[8] = new SimStatsPacket.StatBlock(); - sb[8].StatID = (uint)Stats.OutPacketsPerSecond; - sb[8].StatValue = (int)(m_outPacketsPerSecond / statsUpdatesEveryMS); + sb[8].StatID = (uint)Stats.InPacketsPerSecond; + sb[8].StatValue = (int)(m_inPacketsPerSecond / statsUpdatesEveryMS); sb[9] = new SimStatsPacket.StatBlock(); - sb[9].StatID = (uint)Stats.UnAckedBytes; - sb[9].StatValue = (int) (m_unAckedBytes / statsUpdatesEveryMS); + sb[9].StatID = (uint)Stats.OutPacketsPerSecond; + sb[9].StatValue = (int)(m_outPacketsPerSecond / statsUpdatesEveryMS); + + sb[10] = new SimStatsPacket.StatBlock(); + sb[10].StatID = (uint)Stats.UnAckedBytes; + sb[10].StatValue = (int) (m_unAckedBytes / statsUpdatesEveryMS); statpack.Stat = sb; @@ -147,6 +153,10 @@ namespace OpenSim.Region.Environment.Scenes { m_numPrim = objects; } + public void SetActiveObjects(int objects) + { + m_activePrim = objects; + } public void AddFPS(int frames) { m_fps += frames; -- cgit v1.1