diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Util.cs | 48 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | 4 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 66 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 4 |
5 files changed, 56 insertions, 72 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 7b90239..b5e2872 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -1389,30 +1389,30 @@ namespace OpenSim.Framework | |||
1389 | return null; | 1389 | return null; |
1390 | } | 1390 | } |
1391 | 1391 | ||
1392 | #endregion FireAndForget Threading Pattern | 1392 | #endregion FireAndForget Threading Pattern |
1393 | /// <summary> | 1393 | /// <summary> |
1394 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive | 1394 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive |
1395 | /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap | 1395 | /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap |
1396 | /// for the callers. | 1396 | /// for the callers. |
1397 | /// This trims it to a 12 day interval so don't let your frame time get too long. | 1397 | /// This trims it to a 12 day interval so don't let your frame time get too long. |
1398 | /// </summary> | 1398 | /// </summary> |
1399 | /// <returns></returns> | 1399 | /// <returns></returns> |
1400 | public static Int32 EnvironmentTickCount() | 1400 | public static Int32 EnvironmentTickCount() |
1401 | { | 1401 | { |
1402 | return Environment.TickCount & EnvironmentTickCountMask; | 1402 | return Environment.TickCount & EnvironmentTickCountMask; |
1403 | } | 1403 | } |
1404 | const Int32 EnvironmentTickCountMask = 0x3fffffff; | 1404 | const Int32 EnvironmentTickCountMask = 0x3fffffff; |
1405 | 1405 | ||
1406 | /// <summary> | 1406 | /// <summary> |
1407 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive | 1407 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive |
1408 | /// and negative every 24.9 days. Subtracts the passed value (previously fetched by | 1408 | /// and negative every 24.9 days. Subtracts the passed value (previously fetched by |
1409 | /// 'EnvironmentTickCount()') and accounts for any wrapping. | 1409 | /// 'EnvironmentTickCount()') and accounts for any wrapping. |
1410 | /// </summary> | 1410 | /// </summary> |
1411 | /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns> | 1411 | /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns> |
1412 | public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) | 1412 | public static Int32 EnvironmentTickCountSubtract(Int32 prevValue) |
1413 | { | 1413 | { |
1414 | Int32 diff = EnvironmentTickCount() - prevValue; | 1414 | Int32 diff = EnvironmentTickCount() - prevValue; |
1415 | return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); | 1415 | return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); |
1416 | } | 1416 | } |
1417 | } | 1417 | } |
1418 | } | 1418 | } |
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs index 1e5f15a..55d9c9c 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPClient.cs | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) Contributors, http://opensimulator.org/ | 2 | * Copyright (c) Contributors, http://opensimulator.org/ |
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | 3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. |
4 | * | 4 | * |
@@ -430,7 +430,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
430 | // Send the packet | 430 | // Send the packet |
431 | m_udpServer.SendPacketFinal(nextPacket); | 431 | m_udpServer.SendPacketFinal(nextPacket); |
432 | m_nextPackets[i] = null; | 432 | m_nextPackets[i] = null; |
433 | packetSent = true; | 433 | packetSent = true; |
434 | this.PacketsSent++; | 434 | this.PacketsSent++; |
435 | } | 435 | } |
436 | } | 436 | } |
diff --git a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs index b031f61..50624a1 100644 --- a/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs +++ b/OpenSim/Region/Framework/Scenes/Animation/ScenePresenceAnimator.cs | |||
@@ -448,5 +448,11 @@ namespace OpenSim.Region.Framework.Scenes.Animation | |||
448 | 448 | ||
449 | SendAnimPack(animIDs, sequenceNums, objectIDs); | 449 | SendAnimPack(animIDs, sequenceNums, objectIDs); |
450 | } | 450 | } |
451 | |||
452 | public void Close() | ||
453 | { | ||
454 | m_animations = null; | ||
455 | m_scenePresence = null; | ||
456 | } | ||
451 | } | 457 | } |
452 | } | 458 | } |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 6812914..e55acfe 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -790,37 +790,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
790 | /// </summary> | 790 | /// </summary> |
791 | public void SendPrimUpdates() | 791 | public void SendPrimUpdates() |
792 | { | 792 | { |
793 | m_perfMonMS = EnvironmentTickCount(); | 793 | m_perfMonMS = Util.EnvironmentTickCount(); |
794 | 794 | ||
795 | m_sceneViewer.SendPrimUpdates(); | 795 | m_sceneViewer.SendPrimUpdates(); |
796 | 796 | ||
797 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 797 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
798 | } | 798 | } |
799 | 799 | ||
800 | /// <summary> | ||
801 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive | ||
802 | /// and negative every 24.9 days. This trims down TickCount so it doesn't wrap | ||
803 | /// for the callers. | ||
804 | /// This trims it to a 12 day interval so don't let your frame time get too long. | ||
805 | /// </summary> | ||
806 | /// <returns></returns> | ||
807 | const Int32 EnvironmentTickCountMask = 0x3fffffff; | ||
808 | private static Int32 EnvironmentTickCount() { | ||
809 | return Environment.TickCount & EnvironmentTickCountMask; | ||
810 | } | ||
811 | |||
812 | /// <summary> | ||
813 | /// Environment.TickCount is an int but it counts all 32 bits so it goes positive | ||
814 | /// and negative every 24.9 days. Subtracts the passed value (previously fetched by | ||
815 | /// 'EnvironmentTickCount()') and accounts for any wrapping. | ||
816 | /// </summary> | ||
817 | /// <returns>subtraction of passed prevValue from current Environment.TickCount</returns> | ||
818 | private static Int32 EnvironmentTickCountSubtract(Int32 prevValue) { | ||
819 | Int32 diff = EnvironmentTickCount() - prevValue; | ||
820 | return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); | ||
821 | } | ||
822 | |||
823 | |||
824 | #region Status Methods | 800 | #region Status Methods |
825 | 801 | ||
826 | /// <summary> | 802 | /// <summary> |
@@ -1209,7 +1185,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1209 | // return; | 1185 | // return; |
1210 | //} | 1186 | //} |
1211 | 1187 | ||
1212 | m_perfMonMS = EnvironmentTickCount(); | 1188 | m_perfMonMS = Util.EnvironmentTickCount(); |
1213 | 1189 | ||
1214 | ++m_movementUpdateCount; | 1190 | ++m_movementUpdateCount; |
1215 | if (m_movementUpdateCount < 1) | 1191 | if (m_movementUpdateCount < 1) |
@@ -1539,7 +1515,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1539 | 1515 | ||
1540 | m_scene.EventManager.TriggerOnClientMovement(this); | 1516 | m_scene.EventManager.TriggerOnClientMovement(this); |
1541 | 1517 | ||
1542 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 1518 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
1543 | } | 1519 | } |
1544 | 1520 | ||
1545 | public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) | 1521 | public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) |
@@ -2057,7 +2033,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2057 | return; | 2033 | return; |
2058 | } | 2034 | } |
2059 | 2035 | ||
2060 | m_perfMonMS = EnvironmentTickCount(); | 2036 | m_perfMonMS = Util.EnvironmentTickCount(); |
2061 | 2037 | ||
2062 | Rotation = rotation; | 2038 | Rotation = rotation; |
2063 | Vector3 direc = vec * rotation; | 2039 | Vector3 direc = vec * rotation; |
@@ -2099,7 +2075,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2099 | // TODO: Add the force instead of only setting it to support multiple forces per frame? | 2075 | // TODO: Add the force instead of only setting it to support multiple forces per frame? |
2100 | m_forceToApply = direc; | 2076 | m_forceToApply = direc; |
2101 | m_isNudging = Nudging; | 2077 | m_isNudging = Nudging; |
2102 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCount() - m_perfMonMS); | 2078 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2103 | } | 2079 | } |
2104 | 2080 | ||
2105 | #endregion | 2081 | #endregion |
@@ -2168,7 +2144,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2168 | // server. | 2144 | // server. |
2169 | if (remoteClient.IsActive) | 2145 | if (remoteClient.IsActive) |
2170 | { | 2146 | { |
2171 | m_perfMonMS = EnvironmentTickCount(); | 2147 | m_perfMonMS = Util.EnvironmentTickCount(); |
2172 | 2148 | ||
2173 | PhysicsActor actor = m_physicsActor; | 2149 | PhysicsActor actor = m_physicsActor; |
2174 | Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; | 2150 | Vector3 velocity = (actor != null) ? actor.Velocity : Vector3.Zero; |
@@ -2181,7 +2157,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2181 | remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, | 2157 | remoteClient.SendAvatarTerseUpdate(new SendAvatarTerseData(m_rootRegionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, |
2182 | pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient))); | 2158 | pos, velocity, Vector3.Zero, m_bodyRot, CollisionPlane, m_uuid, null, GetUpdatePriority(remoteClient))); |
2183 | 2159 | ||
2184 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 2160 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2185 | m_scene.StatsReporter.AddAgentUpdates(1); | 2161 | m_scene.StatsReporter.AddAgentUpdates(1); |
2186 | } | 2162 | } |
2187 | } | 2163 | } |
@@ -2191,11 +2167,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2191 | /// </summary> | 2167 | /// </summary> |
2192 | public void SendTerseUpdateToAllClients() | 2168 | public void SendTerseUpdateToAllClients() |
2193 | { | 2169 | { |
2194 | m_perfMonMS = EnvironmentTickCount(); | 2170 | m_perfMonMS = Util.EnvironmentTickCount(); |
2195 | 2171 | ||
2196 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2172 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2197 | 2173 | ||
2198 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 2174 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2199 | } | 2175 | } |
2200 | 2176 | ||
2201 | public void SendCoarseLocations() | 2177 | public void SendCoarseLocations() |
@@ -2215,7 +2191,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2215 | 2191 | ||
2216 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) | 2192 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p) |
2217 | { | 2193 | { |
2218 | m_perfMonMS = EnvironmentTickCount(); | 2194 | m_perfMonMS = Util.EnvironmentTickCount(); |
2219 | 2195 | ||
2220 | List<Vector3> CoarseLocations = new List<Vector3>(); | 2196 | List<Vector3> CoarseLocations = new List<Vector3>(); |
2221 | List<UUID> AvatarUUIDs = new List<UUID>(); | 2197 | List<UUID> AvatarUUIDs = new List<UUID>(); |
@@ -2251,7 +2227,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2251 | 2227 | ||
2252 | m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); | 2228 | m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); |
2253 | 2229 | ||
2254 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 2230 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2255 | } | 2231 | } |
2256 | 2232 | ||
2257 | public void CoarseLocationChange() | 2233 | public void CoarseLocationChange() |
@@ -2288,7 +2264,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2288 | /// </summary> | 2264 | /// </summary> |
2289 | public void SendInitialFullUpdateToAllClients() | 2265 | public void SendInitialFullUpdateToAllClients() |
2290 | { | 2266 | { |
2291 | m_perfMonMS = EnvironmentTickCount(); | 2267 | m_perfMonMS = Util.EnvironmentTickCount(); |
2292 | 2268 | ||
2293 | ScenePresence[] avatars = m_scene.GetScenePresences(); | 2269 | ScenePresence[] avatars = m_scene.GetScenePresences(); |
2294 | 2270 | ||
@@ -2314,14 +2290,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
2314 | } | 2290 | } |
2315 | 2291 | ||
2316 | m_scene.StatsReporter.AddAgentUpdates(avatars.Length); | 2292 | m_scene.StatsReporter.AddAgentUpdates(avatars.Length); |
2317 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 2293 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2318 | 2294 | ||
2319 | //Animator.SendAnimPack(); | 2295 | //Animator.SendAnimPack(); |
2320 | } | 2296 | } |
2321 | 2297 | ||
2322 | public void SendFullUpdateToAllClients() | 2298 | public void SendFullUpdateToAllClients() |
2323 | { | 2299 | { |
2324 | m_perfMonMS = EnvironmentTickCount(); | 2300 | m_perfMonMS = Util.EnvironmentTickCount(); |
2325 | 2301 | ||
2326 | // only send update from root agents to other clients; children are only "listening posts" | 2302 | // only send update from root agents to other clients; children are only "listening posts" |
2327 | List<ScenePresence> avatars = m_scene.GetAvatars(); | 2303 | List<ScenePresence> avatars = m_scene.GetAvatars(); |
@@ -2331,7 +2307,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2331 | 2307 | ||
2332 | } | 2308 | } |
2333 | m_scene.StatsReporter.AddAgentUpdates(avatars.Count); | 2309 | m_scene.StatsReporter.AddAgentUpdates(avatars.Count); |
2334 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 2310 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2335 | 2311 | ||
2336 | Animator.SendAnimPack(); | 2312 | Animator.SendAnimPack(); |
2337 | } | 2313 | } |
@@ -2373,7 +2349,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2373 | /// </summary> | 2349 | /// </summary> |
2374 | public void SendAppearanceToAllOtherAgents() | 2350 | public void SendAppearanceToAllOtherAgents() |
2375 | { | 2351 | { |
2376 | m_perfMonMS = EnvironmentTickCount(); | 2352 | m_perfMonMS = Util.EnvironmentTickCount(); |
2377 | 2353 | ||
2378 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2354 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2379 | { | 2355 | { |
@@ -2382,8 +2358,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2382 | SendAppearanceToOtherAgent(scenePresence); | 2358 | SendAppearanceToOtherAgent(scenePresence); |
2383 | } | 2359 | } |
2384 | }); | 2360 | }); |
2385 | 2361 | ||
2386 | m_scene.StatsReporter.AddAgentTime(EnvironmentTickCountSubtract(m_perfMonMS)); | 2362 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); |
2387 | } | 2363 | } |
2388 | 2364 | ||
2389 | /// <summary> | 2365 | /// <summary> |
@@ -3200,11 +3176,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
3200 | 3176 | ||
3201 | // I don't get it but mono crashes when you try to dispose of this timer, | 3177 | // I don't get it but mono crashes when you try to dispose of this timer, |
3202 | // unsetting the elapsed callback should be enough to allow for cleanup however. | 3178 | // unsetting the elapsed callback should be enough to allow for cleanup however. |
3203 | //m_reprioritizationTimer.Dispose(); | 3179 | // m_reprioritizationTimer.Dispose(); |
3204 | 3180 | ||
3205 | m_sceneViewer.Close(); | 3181 | m_sceneViewer.Close(); |
3206 | 3182 | ||
3207 | RemoveFromPhysicalScene(); | 3183 | RemoveFromPhysicalScene(); |
3184 | m_animator.Close(); | ||
3185 | m_animator = null; | ||
3208 | } | 3186 | } |
3209 | 3187 | ||
3210 | public ScenePresence() | 3188 | public ScenePresence() |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index f92f440..e368c2a 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -75,7 +75,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | UnAckedBytes = 24, | 75 | UnAckedBytes = 24, |
76 | } | 76 | } |
77 | 77 | ||
78 | // Sending a stats update every 3 seconds | 78 | // Sending a stats update every 3 seconds- |
79 | private int statsUpdatesEveryMS = 3000; | 79 | private int statsUpdatesEveryMS = 3000; |
80 | private float statsUpdateFactor = 0; | 80 | private float statsUpdateFactor = 0; |
81 | private float m_timeDilation = 0; | 81 | private float m_timeDilation = 0; |
@@ -240,7 +240,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
240 | sb[12].StatID = (uint)Stats.OtherMS; | 240 | sb[12].StatID = (uint)Stats.OtherMS; |
241 | sb[12].StatValue = m_otherMS / statsUpdateFactor; | 241 | sb[12].StatValue = m_otherMS / statsUpdateFactor; |
242 | 242 | ||
243 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 243 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
244 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); | 244 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); |
245 | 245 | ||
246 | sb[14].StatID = (uint)Stats.OutPacketsPerSecond; | 246 | sb[14].StatID = (uint)Stats.OutPacketsPerSecond; |