diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1acd607d12..cd4b14d27f 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -186,6 +186,7 @@ namespace OpenSim.Region.Framework.Scenes private int m_update_land = 10; private int m_update_coarse_locations = 50; + private int agentMS; private int frameMS; private int physicsMS2; private int physicsMS; @@ -1251,12 +1252,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(); @@ -1283,6 +1287,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(); @@ -1290,7 +1296,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 @@ -1362,6 +1372,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()); diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index afa6e892d2..13668ab9fb 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs @@ -180,6 +180,12 @@ namespace OpenSim.Region.Framework.Scenes } } + /// + /// Update the position of all the scene presences. + /// + /// + /// Called only from the main scene loop. + /// protected internal void UpdatePresences() { ForEachScenePresence(delegate(ScenePresence presence) diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index dee9bc35e5..35f5566335 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -929,11 +929,7 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendPrimUpdates() { - m_perfMonMS = Util.EnvironmentTickCount(); - m_sceneViewer.SendPrimUpdates(); - - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } #region Status Methods @@ -1401,7 +1397,7 @@ namespace OpenSim.Region.Framework.Scenes // return; //} - m_perfMonMS = Util.EnvironmentTickCount(); +// m_perfMonMS = Util.EnvironmentTickCount(); ++m_movementUpdateCount; if (m_movementUpdateCount < 1) @@ -1693,7 +1689,8 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerOnClientMovement(this); - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); + // It doesn't make sense to add this to frame stats as this update is processed indepedently of the scene loop +// m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } /// @@ -2670,8 +2667,6 @@ namespace OpenSim.Region.Framework.Scenes /// The vector in which to move. This is relative to the rotation argument public void AddNewMovement(Vector3 vec) { - m_perfMonMS = Util.EnvironmentTickCount(); - Vector3 direc = vec * Rotation; direc.Normalize(); @@ -2710,8 +2705,6 @@ namespace OpenSim.Region.Framework.Scenes // TODO: Add the force instead of only setting it to support multiple forces per frame? m_forceToApply = direc; - - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } #endregion @@ -2779,8 +2772,6 @@ namespace OpenSim.Region.Framework.Scenes // server. if (remoteClient.IsActive) { - m_perfMonMS = Util.EnvironmentTickCount(); - Vector3 pos = m_pos; pos.Z += m_appearance.HipOffset; @@ -2791,7 +2782,6 @@ namespace OpenSim.Region.Framework.Scenes PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); m_scene.StatsReporter.AddAgentUpdates(1); } } @@ -2832,14 +2822,11 @@ namespace OpenSim.Region.Framework.Scenes || Math.Abs(distanceError) > distanceErrorThreshold || velocidyDiff > 0.01f) // did velocity change from last update? { - m_perfMonMS = currentTick; lastVelocitySentToAllClients = Velocity; lastTerseUpdateToAllClientsTick = currentTick; lastPositionSentToAllClients = OffsetPosition; m_scene.ForEachClient(SendTerseUpdateToClient); - - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } } @@ -2860,9 +2847,7 @@ namespace OpenSim.Region.Framework.Scenes public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List coarseLocations, List avatarUUIDs) { - m_perfMonMS = Util.EnvironmentTickCount(); m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } /// @@ -2923,8 +2908,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); return; } - - m_perfMonMS = Util.EnvironmentTickCount(); int count = 0; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) @@ -2934,7 +2917,6 @@ namespace OpenSim.Region.Framework.Scenes }); m_scene.StatsReporter.AddAgentUpdates(count); - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } /// @@ -2943,8 +2925,6 @@ namespace OpenSim.Region.Framework.Scenes /// public void SendOtherAgentsAvatarDataToMe() { - m_perfMonMS = Util.EnvironmentTickCount(); - int count = 0; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) { @@ -2961,7 +2941,6 @@ namespace OpenSim.Region.Framework.Scenes }); m_scene.StatsReporter.AddAgentUpdates(count); - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } /// @@ -2990,8 +2969,6 @@ namespace OpenSim.Region.Framework.Scenes m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); return; } - - m_perfMonMS = Util.EnvironmentTickCount(); int count = 0; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) @@ -3004,7 +2981,6 @@ namespace OpenSim.Region.Framework.Scenes }); m_scene.StatsReporter.AddAgentUpdates(count); - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } /// @@ -3014,7 +2990,6 @@ namespace OpenSim.Region.Framework.Scenes public void SendOtherAgentsAppearanceToMe() { //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); - m_perfMonMS = Util.EnvironmentTickCount(); int count = 0; m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) @@ -3032,7 +3007,6 @@ namespace OpenSim.Region.Framework.Scenes }); m_scene.StatsReporter.AddAgentUpdates(count); - m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); } /// diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 2d92ed8913..282b677ee5 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -452,12 +452,6 @@ namespace OpenSim.Region.Framework.Scenes AddOutPackets(outPackets); AddunAckedBytes(unAckedBytes); } - - public void AddAgentTime(int ms) - { - addFrameMS(ms); - addAgentMS(ms); - } #endregion }