* Modified ScenePresence to use the Util version of the EnvironmentTickCount method (and it's subtract method). Remove redundant EnvironmentTickCount definitions in ScenePresence.
parent
17136724e2
commit
0cb4ff1b68
|
@ -754,38 +754,14 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// timestamp has already been sent.
|
||||
/// </summary>
|
||||
public void SendPrimUpdates()
|
||||
{
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
m_sceneViewer.SendPrimUpdates();
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_sceneViewer.SendPrimUpdates();
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
|
||||
/// for the callers.
|
||||
/// This trims it to a 12 day interval so don't let your frame time get too long.
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
const Int32 EnvironmentTickCountMask = 0x3fffffff;
|
||||
private static Int32 EnvironmentTickCount() {
|
||||
return Environment.TickCount & EnvironmentTickCountMask;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Environment.TickCount is an int but it counts all 32 bits so it goes positive
|
||||
/// and negative every 24.9 days. Subtracts the passed value (previously fetched by
|
||||
/// 'EnvironmentTickCount()') and accounts for any wrapping.
|
||||
/// </summary>
|
||||
/// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
|
||||
private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) {
|
||||
Int32 diff = EnvironmentTickCount() - prevValue;
|
||||
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
|
||||
}
|
||||
|
||||
|
||||
#region Status Methods
|
||||
|
||||
/// <summary>
|
||||
|
@ -1172,7 +1148,7 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// return;
|
||||
//}
|
||||
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
++m_movementUpdateCount;
|
||||
if (m_movementUpdateCount < 1)
|
||||
|
@ -1486,9 +1462,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_scene.EventManager.TriggerOnClientMovement(this);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
|
||||
|
@ -1946,9 +1922,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
}
|
||||
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
Rotation = rotation;
|
||||
Vector3 direc = vec * rotation;
|
||||
|
@ -1988,9 +1964,9 @@ 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(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_forceToApply = direc;
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -2055,8 +2031,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
// If the client is inactive, it's getting its updates from another
|
||||
// server.
|
||||
if (remoteClient.IsActive)
|
||||
{
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
PhysicsActor actor = m_physicsActor;
|
||||
Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
|
||||
|
@ -2067,9 +2043,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//m_log.DebugFormat("[SCENEPRESENCE]: TerseUpdate: Pos={0} Rot={1} Vel={2}", m_pos, m_bodyRot, m_velocity);
|
||||
|
||||
remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
|
||||
pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_scene.StatsReporter.AddAgentUpdates(1);
|
||||
}
|
||||
}
|
||||
|
@ -2078,12 +2054,12 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// Send a location/velocity/accelleration update to all agents in scene
|
||||
/// </summary>
|
||||
public void SendTerseUpdateToAllClients()
|
||||
{
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_scene.ForEachClient(SendTerseUpdateToClient);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void SendCoarseLocations()
|
||||
|
@ -2102,8 +2078,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
|
||||
public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
|
||||
{
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
List<Vector3> CoarseLocations = new List<Vector3>();
|
||||
List<UUID> AvatarUUIDs = new List<UUID>();
|
||||
|
@ -2137,9 +2113,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
//}
|
||||
}
|
||||
|
||||
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
public void CoarseLocationChange()
|
||||
|
@ -2175,8 +2151,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
/// Tell *ALL* agents about this agent
|
||||
/// </summary>
|
||||
public void SendInitialFullUpdateToAllClients()
|
||||
{
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
ScenePresence[] avatars = m_scene.GetScenePresences();
|
||||
|
||||
|
@ -2201,15 +2177,15 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
}
|
||||
}
|
||||
|
||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
|
||||
//Animator.SendAnimPack();
|
||||
}
|
||||
|
||||
public void SendFullUpdateToAllClients()
|
||||
{
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
// only send update from root agents to other clients; children are only "listening posts"
|
||||
List<ScenePresence> avatars = m_scene.GetAvatars();
|
||||
|
@ -2218,8 +2194,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
SendFullUpdateToOtherClient(avatar);
|
||||
|
||||
}
|
||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
|
||||
Animator.SendAnimPack();
|
||||
}
|
||||
|
@ -2260,8 +2236,8 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
///
|
||||
/// </summary>
|
||||
public void SendAppearanceToAllOtherAgents()
|
||||
{
|
||||
m_perfMonMS = EnvironmentTickCount();
|
||||
{
|
||||
m_perfMonMS = Util.EnvironmentTickCount();
|
||||
|
||||
m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
|
||||
{
|
||||
|
@ -2269,9 +2245,9 @@ namespace OpenSim.Region.Framework.Scenes
|
|||
{
|
||||
SendAppearanceToOtherAgent(scenePresence);
|
||||
}
|
||||
});
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
});
|
||||
|
||||
m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in New Issue