From ca83f99332316fda1c412a5bf2889f9cf5cf3577 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Thu, 6 Oct 2011 00:45:25 +0100 Subject: Instead of adding stat agentMS in all kinds of places, calculate it instead in the main Scene.Update() loop, like the other stats Some of the places where agentMS was added were in separate threads launched by the update loop. I don't believe this is correct, since such threads are no longer contributing to frame time. Some of the places were also driven by client input rather than the scene loop. I don't believe it's appropriate to add this kind of stuff to scene loop stats. These changes hopefully have the nice affect of making the broken out frame stats actually add up to the total frame time --- OpenSim/Region/Framework/Scenes/Scene.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e4ebcff..b1755ac 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -183,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes // private int m_update_land = 1; private int m_update_coarse_locations = 50; + private int agentMS; private int frameMS; private int physicsMS2; private int physicsMS; @@ -1226,12 +1227,15 @@ namespace OpenSim.Region.Framework.Scenes int maintc = Util.EnvironmentTickCount(); int tmpFrameMS = maintc; - tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; + agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; + // TODO: ADD AGENT TIME HERE // Increment the frame counter ++Frame; try { + int tmpAgentMS = Util.EnvironmentTickCount(); + // Check if any objects have reached their targets CheckAtTargets(); @@ -1258,6 +1262,8 @@ namespace OpenSim.Region.Framework.Scenes }); } + agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); + int tmpPhysicsMS2 = Util.EnvironmentTickCount(); if ((Frame % m_update_physics == 0) && m_physics_enabled) m_sceneGraph.UpdatePreparePhysics(); @@ -1265,7 +1271,11 @@ namespace OpenSim.Region.Framework.Scenes // Apply any pending avatar force input to the avatar's velocity if (Frame % m_update_entitymovement == 0) + { + tmpAgentMS = Util.EnvironmentTickCount(); m_sceneGraph.UpdateScenePresenceMovement(); + agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); + } // Perform the main physics update. This will do the actual work of moving objects and avatars according to their // velocity @@ -1330,6 +1340,7 @@ namespace OpenSim.Region.Framework.Scenes StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); StatsReporter.addFrameMS(frameMS); + StatsReporter.addAgentMS(agentMS); StatsReporter.addPhysicsMS(physicsMS + physicsMS2); StatsReporter.addOtherMS(otherMS); StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); -- cgit v1.1