aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/ScenePresence.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs60
1 files changed, 42 insertions, 18 deletions
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index 5604e3d..bcad335 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -755,13 +755,37 @@ namespace OpenSim.Region.Framework.Scenes
755 /// </summary> 755 /// </summary>
756 public void SendPrimUpdates() 756 public void SendPrimUpdates()
757 { 757 {
758 m_perfMonMS = Environment.TickCount; 758 m_perfMonMS = EnvironmentTickCount();
759 759
760 m_sceneViewer.SendPrimUpdates(); 760 m_sceneViewer.SendPrimUpdates();
761 761
762 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 762 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
763 } 763 }
764 764
765 /// <summary>
766 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
767 /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap
768 /// for the callers.
769 /// This trims it to a 12 day interval so don't let your frame time get too long.
770 /// </summary>
771 /// <returns></returns>
772 const Int32 EnvironmentTickCountMask = 0x3fffffff;
773 private static Int32 EnvironmentTickCount() {
774 return Environment.TickCount & EnvironmentTickCountMask;
775 }
776
777 /// <summary>
778 /// Environment.TickCount is an int but it counts all 32 bits so it goes positive
779 /// and negative every 24.9 days. Subtracts the passed value (previously fetched by
780 /// 'EnvironmentTickCount()') and accounts for any wrapping.
781 /// </summary>
782 /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns>
783 private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) {
784 Int32 diff = EnvironmentTickCount() - prevValue;
785 return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
786 }
787
788
765 #region Status Methods 789 #region Status Methods
766 790
767 /// <summary> 791 /// <summary>
@@ -1148,7 +1172,7 @@ namespace OpenSim.Region.Framework.Scenes
1148 // return; 1172 // return;
1149 //} 1173 //}
1150 1174
1151 m_perfMonMS = Environment.TickCount; 1175 m_perfMonMS = EnvironmentTickCount();
1152 1176
1153 ++m_movementUpdateCount; 1177 ++m_movementUpdateCount;
1154 if (m_movementUpdateCount < 1) 1178 if (m_movementUpdateCount < 1)
@@ -1464,7 +1488,7 @@ namespace OpenSim.Region.Framework.Scenes
1464 1488
1465 m_scene.EventManager.TriggerOnClientMovement(this); 1489 m_scene.EventManager.TriggerOnClientMovement(this);
1466 1490
1467 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 1491 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
1468 } 1492 }
1469 1493
1470 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) 1494 public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
@@ -1924,7 +1948,7 @@ namespace OpenSim.Region.Framework.Scenes
1924 return; 1948 return;
1925 } 1949 }
1926 1950
1927 m_perfMonMS = Environment.TickCount; 1951 m_perfMonMS = EnvironmentTickCount();
1928 1952
1929 Rotation = rotation; 1953 Rotation = rotation;
1930 Vector3 direc = vec * rotation; 1954 Vector3 direc = vec * rotation;
@@ -1966,7 +1990,7 @@ namespace OpenSim.Region.Framework.Scenes
1966 // TODO: Add the force instead of only setting it to support multiple forces per frame? 1990 // TODO: Add the force instead of only setting it to support multiple forces per frame?
1967 m_forceToApply = direc; 1991 m_forceToApply = direc;
1968 1992
1969 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 1993 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
1970 } 1994 }
1971 1995
1972 #endregion 1996 #endregion
@@ -2032,7 +2056,7 @@ namespace OpenSim.Region.Framework.Scenes
2032 // server. 2056 // server.
2033 if (remoteClient.IsActive) 2057 if (remoteClient.IsActive)
2034 { 2058 {
2035 m_perfMonMS = Environment.TickCount; 2059 m_perfMonMS = EnvironmentTickCount();
2036 2060
2037 PhysicsActor actor = m_physicsActor; 2061 PhysicsActor actor = m_physicsActor;
2038 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; 2062 Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero;
@@ -2045,7 +2069,7 @@ namespace OpenSim.Region.Framework.Scenes
2045 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, 2069 remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId,
2046 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient))); 2070 pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient)));
2047 2071
2048 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2072 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2049 m_scene.StatsReporter.AddAgentUpdates(1); 2073 m_scene.StatsReporter.AddAgentUpdates(1);
2050 } 2074 }
2051 } 2075 }
@@ -2055,11 +2079,11 @@ namespace OpenSim.Region.Framework.Scenes
2055 /// </summary> 2079 /// </summary>
2056 public void SendTerseUpdateToAllClients() 2080 public void SendTerseUpdateToAllClients()
2057 { 2081 {
2058 m_perfMonMS = Environment.TickCount; 2082 m_perfMonMS = EnvironmentTickCount();
2059 2083
2060 m_scene.ForEachClient(SendTerseUpdateToClient); 2084 m_scene.ForEachClient(SendTerseUpdateToClient);
2061 2085
2062 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2086 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2063 } 2087 }
2064 2088
2065 public void SendCoarseLocations() 2089 public void SendCoarseLocations()
@@ -2079,7 +2103,7 @@ namespace OpenSim.Region.Framework.Scenes
2079 2103
2080 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) 2104 public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p)
2081 { 2105 {
2082 m_perfMonMS = Environment.TickCount; 2106 m_perfMonMS = EnvironmentTickCount();
2083 2107
2084 List<Vector3> CoarseLocations = new List<Vector3>(); 2108 List<Vector3> CoarseLocations = new List<Vector3>();
2085 List<UUID> AvatarUUIDs = new List<UUID>(); 2109 List<UUID> AvatarUUIDs = new List<UUID>();
@@ -2115,7 +2139,7 @@ namespace OpenSim.Region.Framework.Scenes
2115 2139
2116 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); 2140 m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
2117 2141
2118 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2142 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2119 } 2143 }
2120 2144
2121 public void CoarseLocationChange() 2145 public void CoarseLocationChange()
@@ -2152,7 +2176,7 @@ namespace OpenSim.Region.Framework.Scenes
2152 /// </summary> 2176 /// </summary>
2153 public void SendInitialFullUpdateToAllClients() 2177 public void SendInitialFullUpdateToAllClients()
2154 { 2178 {
2155 m_perfMonMS = Environment.TickCount; 2179 m_perfMonMS = EnvironmentTickCount();
2156 2180
2157 ScenePresence[] avatars = m_scene.GetScenePresences(); 2181 ScenePresence[] avatars = m_scene.GetScenePresences();
2158 2182
@@ -2178,14 +2202,14 @@ namespace OpenSim.Region.Framework.Scenes
2178 } 2202 }
2179 2203
2180 m_scene.StatsReporter.AddAgentUpdates(avatars.Length); 2204 m_scene.StatsReporter.AddAgentUpdates(avatars.Length);
2181 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2205 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2182 2206
2183 //Animator.SendAnimPack(); 2207 //Animator.SendAnimPack();
2184 } 2208 }
2185 2209
2186 public void SendFullUpdateToAllClients() 2210 public void SendFullUpdateToAllClients()
2187 { 2211 {
2188 m_perfMonMS = Environment.TickCount; 2212 m_perfMonMS = EnvironmentTickCount();
2189 2213
2190 // only send update from root agents to other clients; children are only "listening posts" 2214 // only send update from root agents to other clients; children are only "listening posts"
2191 List<ScenePresence> avatars = m_scene.GetAvatars(); 2215 List<ScenePresence> avatars = m_scene.GetAvatars();
@@ -2195,7 +2219,7 @@ namespace OpenSim.Region.Framework.Scenes
2195 2219
2196 } 2220 }
2197 m_scene.StatsReporter.AddAgentUpdates(avatars.Count); 2221 m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
2198 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2222 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2199 2223
2200 Animator.SendAnimPack(); 2224 Animator.SendAnimPack();
2201 } 2225 }
@@ -2237,7 +2261,7 @@ namespace OpenSim.Region.Framework.Scenes
2237 /// </summary> 2261 /// </summary>
2238 public void SendAppearanceToAllOtherAgents() 2262 public void SendAppearanceToAllOtherAgents()
2239 { 2263 {
2240 m_perfMonMS = Environment.TickCount; 2264 m_perfMonMS = EnvironmentTickCount();
2241 2265
2242 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) 2266 m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence)
2243 { 2267 {
@@ -2247,7 +2271,7 @@ namespace OpenSim.Region.Framework.Scenes
2247 } 2271 }
2248 }); 2272 });
2249 2273
2250 m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); 2274 m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS));
2251 } 2275 }
2252 2276
2253 /// <summary> 2277 /// <summary>