From fe3594c5ea4fe36f862375f76d088f64d2dfb269 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 11 Oct 2011 22:17:05 +0100 Subject: Start recording object updates per second statistic (analogue of agent updates per secod) and expose via monitoring module as ObjectUpdatePerSecondMonitor A useful diagnostic to find out how object updates are burdening a scene --- .../Framework/Monitoring/MonitorModule.cs | 8 +++++++ OpenSim/Region/Framework/Scenes/SceneObjectPart.cs | 8 ++++++- .../Region/Framework/Scenes/SimStatsReporter.cs | 28 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs index 64997af..a75d94a 100644 --- a/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs +++ b/OpenSim/Region/CoreModules/Framework/Monitoring/MonitorModule.cs @@ -203,6 +203,14 @@ namespace OpenSim.Region.CoreModules.Framework.Monitoring m_monitors.Add( new GenericMonitor( m_scene, + "ObjectUpdatesPerSecondMonitor", + "Object Updates", + m => m.Scene.StatsReporter.LastReportedObjectUpdates, + m => string.Format("{0} per second", m.GetValue()))); + + m_monitors.Add( + new GenericMonitor( + m_scene, "ActiveObjectCountMonitor", "Active Objects", m => m.Scene.StatsReporter.LastReportedSimStats[7], diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 6fa82b8..4abece1 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -3018,6 +3018,7 @@ namespace OpenSim.Region.Framework.Scenes //isattachment = ParentGroup.RootPart.IsAttachment; remoteClient.SendPrimUpdate(this, PrimUpdateFlags.FullUpdate); + ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); } /// @@ -4792,7 +4793,12 @@ namespace OpenSim.Region.Framework.Scenes // Causes this thread to dig into the Client Thread Data. // Remember your locking here! - remoteClient.SendPrimUpdate(this, PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + remoteClient.SendPrimUpdate( + this, + PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity + | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); + + ParentGroup.Scene.StatsReporter.AddObjectUpdates(1); } public void AddScriptLPS(int count) diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 8e1c8f0..6efbaa1 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -86,6 +86,15 @@ namespace OpenSim.Region.Framework.Scenes get { return lastReportedSimFPS; } } + /// + /// Number of object updates performed in the last stats cycle + /// + /// + /// This isn't sent out to the client but it is very useful data to detect whether viewers are being sent a + /// large number of object updates. + /// + public float LastReportedObjectUpdates { get; private set; } + public float[] LastReportedSimStats { get { return lastReportedSimStats; } @@ -100,8 +109,17 @@ namespace OpenSim.Region.Framework.Scenes private float lastReportedSimFPS = 0; private float[] lastReportedSimStats = new float[21]; private float m_pfps = 0; + + /// + /// Number of agent updates requested in this stats cycle + /// private int m_agentUpdates = 0; + /// + /// Number of object updates requested in this stats cycle + /// + private int m_objectUpdates; + private int m_frameMS = 0; private int m_netMS = 0; private int m_agentMS = 0; @@ -291,6 +309,10 @@ namespace OpenSim.Region.Framework.Scenes { handlerSendStatResult(simStats); } + + // Extra statistics that aren't currently sent to clients + LastReportedObjectUpdates = m_objectUpdates / statsUpdateFactor; + resetvalues(); } } @@ -301,6 +323,7 @@ namespace OpenSim.Region.Framework.Scenes m_fps = 0; m_pfps = 0; m_agentUpdates = 0; + m_objectUpdates = 0; //m_inPacketsPerSecond = 0; //m_outPacketsPerSecond = 0; m_unAckedBytes = 0; @@ -382,6 +405,11 @@ namespace OpenSim.Region.Framework.Scenes m_pfps += frames; } + public void AddObjectUpdates(int numUpdates) + { + m_objectUpdates += numUpdates; + } + public void AddAgentUpdates(int numUpdates) { m_agentUpdates += numUpdates; -- cgit v1.1