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 timeremove-scene-viewer
parent
7fa1c979cf
commit
ca83f99332
|
@ -183,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// private int m_update_land = 1;
|
// private int m_update_land = 1;
|
||||||
private int m_update_coarse_locations = 50;
|
private int m_update_coarse_locations = 50;
|
||||||
|
|
||||||
|
private int agentMS;
|
||||||
private int frameMS;
|
private int frameMS;
|
||||||
private int physicsMS2;
|
private int physicsMS2;
|
||||||
private int physicsMS;
|
private int physicsMS;
|
||||||
|
@ -1226,12 +1227,15 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
int maintc = Util.EnvironmentTickCount();
|
int maintc = Util.EnvironmentTickCount();
|
||||||
int tmpFrameMS = maintc;
|
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
|
// Increment the frame counter
|
||||||
++Frame;
|
++Frame;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
int tmpAgentMS = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
// Check if any objects have reached their targets
|
// Check if any objects have reached their targets
|
||||||
CheckAtTargets();
|
CheckAtTargets();
|
||||||
|
|
||||||
|
@ -1258,6 +1262,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS);
|
||||||
|
|
||||||
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
|
int tmpPhysicsMS2 = Util.EnvironmentTickCount();
|
||||||
if ((Frame % m_update_physics == 0) && m_physics_enabled)
|
if ((Frame % m_update_physics == 0) && m_physics_enabled)
|
||||||
m_sceneGraph.UpdatePreparePhysics();
|
m_sceneGraph.UpdatePreparePhysics();
|
||||||
|
@ -1265,7 +1271,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// Apply any pending avatar force input to the avatar's velocity
|
// Apply any pending avatar force input to the avatar's velocity
|
||||||
if (Frame % m_update_entitymovement == 0)
|
if (Frame % m_update_entitymovement == 0)
|
||||||
|
{
|
||||||
|
tmpAgentMS = Util.EnvironmentTickCount();
|
||||||
m_sceneGraph.UpdateScenePresenceMovement();
|
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
|
// Perform the main physics update. This will do the actual work of moving objects and avatars according to their
|
||||||
// velocity
|
// velocity
|
||||||
|
@ -1330,6 +1340,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
|
StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
|
||||||
StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
|
StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
|
||||||
StatsReporter.addFrameMS(frameMS);
|
StatsReporter.addFrameMS(frameMS);
|
||||||
|
StatsReporter.addAgentMS(agentMS);
|
||||||
StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
|
StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
|
||||||
StatsReporter.addOtherMS(otherMS);
|
StatsReporter.addOtherMS(otherMS);
|
||||||
StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
|
StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
|
||||||
|
|
|
@ -166,6 +166,12 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Update the position of all the scene presences.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Called only from the main scene loop.
|
||||||
|
/// </remarks>
|
||||||
protected internal void UpdatePresences()
|
protected internal void UpdatePresences()
|
||||||
{
|
{
|
||||||
ForEachScenePresence(delegate(ScenePresence presence)
|
ForEachScenePresence(delegate(ScenePresence presence)
|
||||||
|
|
|
@ -847,11 +847,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendPrimUpdates()
|
public void SendPrimUpdates()
|
||||||
{
|
{
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
m_sceneViewer.SendPrimUpdates();
|
m_sceneViewer.SendPrimUpdates();
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Status Methods
|
#region Status Methods
|
||||||
|
@ -1253,7 +1249,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
// m_perfMonMS = Util.EnvironmentTickCount();
|
||||||
|
|
||||||
++m_movementUpdateCount;
|
++m_movementUpdateCount;
|
||||||
if (m_movementUpdateCount < 1)
|
if (m_movementUpdateCount < 1)
|
||||||
|
@ -1545,7 +1541,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2325,8 +2322,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
|
/// <param name="vec">The vector in which to move. This is relative to the rotation argument</param>
|
||||||
public void AddNewMovement(Vector3 vec)
|
public void AddNewMovement(Vector3 vec)
|
||||||
{
|
{
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
Vector3 direc = vec * Rotation;
|
Vector3 direc = vec * Rotation;
|
||||||
direc.Normalize();
|
direc.Normalize();
|
||||||
|
|
||||||
|
@ -2365,8 +2360,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
// TODO: Add the force instead of only setting it to support multiple forces per frame?
|
// TODO: Add the force instead of only setting it to support multiple forces per frame?
|
||||||
m_forceToApply = direc;
|
m_forceToApply = direc;
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -2431,8 +2424,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
// server.
|
// server.
|
||||||
if (remoteClient.IsActive)
|
if (remoteClient.IsActive)
|
||||||
{
|
{
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
Vector3 pos = m_pos;
|
Vector3 pos = m_pos;
|
||||||
pos.Z += m_appearance.HipOffset;
|
pos.Z += m_appearance.HipOffset;
|
||||||
|
|
||||||
|
@ -2443,7 +2434,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
|
PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity
|
||||||
| PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
|
| PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity);
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2484,14 +2474,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|| Math.Abs(distanceError) > distanceErrorThreshold
|
|| Math.Abs(distanceError) > distanceErrorThreshold
|
||||||
|| velocidyDiff > 0.01f) // did velocity change from last update?
|
|| velocidyDiff > 0.01f) // did velocity change from last update?
|
||||||
{
|
{
|
||||||
m_perfMonMS = currentTick;
|
|
||||||
lastVelocitySentToAllClients = Velocity;
|
lastVelocitySentToAllClients = Velocity;
|
||||||
lastTerseUpdateToAllClientsTick = currentTick;
|
lastTerseUpdateToAllClientsTick = currentTick;
|
||||||
lastPositionSentToAllClients = OffsetPosition;
|
lastPositionSentToAllClients = OffsetPosition;
|
||||||
|
|
||||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2512,9 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs)
|
||||||
{
|
{
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
|
m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations);
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2576,8 +2561,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
{
|
{
|
||||||
|
@ -2586,7 +2569,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(count);
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2595,8 +2577,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void SendOtherAgentsAvatarDataToMe()
|
public void SendOtherAgentsAvatarDataToMe()
|
||||||
{
|
{
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
{
|
{
|
||||||
|
@ -2613,7 +2593,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(count);
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2643,8 +2622,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
{
|
{
|
||||||
|
@ -2656,7 +2633,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(count);
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -2666,7 +2642,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
public void SendOtherAgentsAppearanceToMe()
|
public void SendOtherAgentsAppearanceToMe()
|
||||||
{
|
{
|
||||||
//m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID);
|
//m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID);
|
||||||
m_perfMonMS = Util.EnvironmentTickCount();
|
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||||
|
@ -2684,7 +2659,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
});
|
});
|
||||||
|
|
||||||
m_scene.StatsReporter.AddAgentUpdates(count);
|
m_scene.StatsReporter.AddAgentUpdates(count);
|
||||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -453,12 +453,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
AddunAckedBytes(unAckedBytes);
|
AddunAckedBytes(unAckedBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddAgentTime(int ms)
|
|
||||||
{
|
|
||||||
addFrameMS(ms);
|
|
||||||
addAgentMS(ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue