diff options
author | Justin Clarke Casey | 2009-04-03 17:14:51 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-04-03 17:14:51 +0000 |
commit | 5146cb7a72d7f41dd9a3c022b48a75138259d977 (patch) | |
tree | 0b1045b389dc49083cebf64798b80a7ea326cd42 | |
parent | Added one more delegate to Caps, and a few guards, so that these objects can ... (diff) | |
download | opensim-SC-5146cb7a72d7f41dd9a3c022b48a75138259d977.zip opensim-SC-5146cb7a72d7f41dd9a3c022b48a75138259d977.tar.gz opensim-SC-5146cb7a72d7f41dd9a3c022b48a75138259d977.tar.bz2 opensim-SC-5146cb7a72d7f41dd9a3c022b48a75138259d977.tar.xz |
* refactor: Call StatsReporter methods directly rather than through Scene (as WebStatsModule was doing)
* Assume that StatsReporter is always present (possibly as a no-op impl) rather than doing null checks
5 files changed, 26 insertions, 44 deletions
diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs index 124f0f6..f976087 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/TextureDownloadModule.cs | |||
@@ -291,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload | |||
291 | { | 291 | { |
292 | sender.Sending = false; | 292 | sender.Sending = false; |
293 | //m_log.DebugFormat("[TEXTURE]: Removing download stat for {0}", sender.assetID); | 293 | //m_log.DebugFormat("[TEXTURE]: Removing download stat for {0}", sender.assetID); |
294 | m_scene.AddPendingDownloads(-1); | 294 | m_scene.StatsReporter.AddPendingDownloads(-1); |
295 | } | 295 | } |
296 | } | 296 | } |
297 | } | 297 | } |
diff --git a/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs b/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs index ae71fda..e4a2b21 100644 --- a/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs +++ b/OpenSim/Region/CoreModules/Agent/TextureDownload/UserTextureDownloadService.cs | |||
@@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload | |||
147 | return; | 147 | return; |
148 | } | 148 | } |
149 | 149 | ||
150 | m_scene.AddPendingDownloads(1); | 150 | m_scene.StatsReporter.AddPendingDownloads(1); |
151 | 151 | ||
152 | TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber); | 152 | TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber); |
153 | m_textureSenders.Add(e.RequestedAssetID, requestHandler); | 153 | m_textureSenders.Add(e.RequestedAssetID, requestHandler); |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c9e13ac..5f68ccb 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1970,12 +1970,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1970 | client.OnUnackedTerrain += TerrainUnAcked; | 1970 | client.OnUnackedTerrain += TerrainUnAcked; |
1971 | client.OnObjectOwner += ObjectOwner; | 1971 | client.OnObjectOwner += ObjectOwner; |
1972 | 1972 | ||
1973 | IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); | 1973 | IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); |
1974 | client.OnGodKickUser += godsModule.KickUser; | 1974 | client.OnGodKickUser += godsModule.KickUser; |
1975 | client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; | 1975 | client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; |
1976 | 1976 | ||
1977 | if (StatsReporter != null) | 1977 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; |
1978 | client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats; | ||
1979 | 1978 | ||
1980 | // EventManager.TriggerOnNewClient(client); | 1979 | // EventManager.TriggerOnNewClient(client); |
1981 | } | 1980 | } |
@@ -2793,29 +2792,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2793 | m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); | 2792 | m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); |
2794 | } | 2793 | } |
2795 | 2794 | ||
2796 | public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes) | ||
2797 | { | ||
2798 | StatsReporter.AddInPackets(inPackets); | ||
2799 | StatsReporter.AddOutPackets(outPackets); | ||
2800 | StatsReporter.AddunAckedBytes(unAckedBytes); | ||
2801 | } | ||
2802 | |||
2803 | public void AddAgentTime(int ms) | ||
2804 | { | ||
2805 | StatsReporter.addFrameMS(ms); | ||
2806 | StatsReporter.addAgentMS(ms); | ||
2807 | } | ||
2808 | |||
2809 | public void AddAgentUpdates(int count) | ||
2810 | { | ||
2811 | StatsReporter.AddAgentUpdates(count); | ||
2812 | } | ||
2813 | |||
2814 | public void AddPendingDownloads(int count) | ||
2815 | { | ||
2816 | StatsReporter.addPendingDownload(count); | ||
2817 | } | ||
2818 | |||
2819 | #endregion | 2795 | #endregion |
2820 | 2796 | ||
2821 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) | 2797 | public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 8b68d4f..58a2f2a 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -799,7 +799,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
799 | break; | 799 | break; |
800 | } | 800 | } |
801 | 801 | ||
802 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 802 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
803 | } | 803 | } |
804 | 804 | ||
805 | #region Status Methods | 805 | #region Status Methods |
@@ -1382,7 +1382,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1382 | 1382 | ||
1383 | m_scene.EventManager.TriggerOnClientMovement(this); | 1383 | m_scene.EventManager.TriggerOnClientMovement(this); |
1384 | 1384 | ||
1385 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 1385 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
1386 | } | 1386 | } |
1387 | 1387 | ||
1388 | public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) | 1388 | public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) |
@@ -2068,7 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2068 | newVelocity.Z = direc.Z; | 2068 | newVelocity.Z = direc.Z; |
2069 | m_forcesList.Add(newVelocity); | 2069 | m_forcesList.Add(newVelocity); |
2070 | 2070 | ||
2071 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2071 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2072 | } | 2072 | } |
2073 | 2073 | ||
2074 | #endregion | 2074 | #endregion |
@@ -2140,8 +2140,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2140 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), | 2140 | remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), |
2141 | new Vector3(vel.X, vel.Y, vel.Z), rot); | 2141 | new Vector3(vel.X, vel.Y, vel.Z), rot); |
2142 | 2142 | ||
2143 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2143 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2144 | m_scene.AddAgentUpdates(1); | 2144 | m_scene.StatsReporter.AddAgentUpdates(1); |
2145 | } | 2145 | } |
2146 | } | 2146 | } |
2147 | 2147 | ||
@@ -2158,7 +2158,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2158 | lastPhysPos = AbsolutePosition; | 2158 | lastPhysPos = AbsolutePosition; |
2159 | lastPhysRot = m_bodyRot; | 2159 | lastPhysRot = m_bodyRot; |
2160 | 2160 | ||
2161 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2161 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2162 | 2162 | ||
2163 | } | 2163 | } |
2164 | 2164 | ||
@@ -2199,7 +2199,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2199 | 2199 | ||
2200 | m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); | 2200 | m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); |
2201 | 2201 | ||
2202 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2202 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2203 | } | 2203 | } |
2204 | 2204 | ||
2205 | public void CoarseLocationChange() | 2205 | public void CoarseLocationChange() |
@@ -2231,7 +2231,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2231 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, | 2231 | remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, |
2232 | LocalId, m_pos, m_appearance.Texture.GetBytes(), | 2232 | LocalId, m_pos, m_appearance.Texture.GetBytes(), |
2233 | m_parentID, rot); | 2233 | m_parentID, rot); |
2234 | m_scene.AddAgentUpdates(1); | 2234 | m_scene.StatsReporter.AddAgentUpdates(1); |
2235 | } | 2235 | } |
2236 | 2236 | ||
2237 | /// <summary> | 2237 | /// <summary> |
@@ -2260,8 +2260,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
2260 | } | 2260 | } |
2261 | } | 2261 | } |
2262 | } | 2262 | } |
2263 | m_scene.AddAgentUpdates(avatars.Count); | 2263 | |
2264 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2264 | m_scene.StatsReporter.AddAgentUpdates(avatars.Count); |
2265 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); | ||
2265 | 2266 | ||
2266 | //SendAnimPack(); | 2267 | //SendAnimPack(); |
2267 | } | 2268 | } |
@@ -2277,8 +2278,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
2277 | SendFullUpdateToOtherClient(avatar); | 2278 | SendFullUpdateToOtherClient(avatar); |
2278 | 2279 | ||
2279 | } | 2280 | } |
2280 | m_scene.AddAgentUpdates(avatars.Count); | 2281 | m_scene.StatsReporter.AddAgentUpdates(avatars.Count); |
2281 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2282 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2282 | 2283 | ||
2283 | SendAnimPack(); | 2284 | SendAnimPack(); |
2284 | } | 2285 | } |
@@ -2333,7 +2334,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2333 | } | 2334 | } |
2334 | }); | 2335 | }); |
2335 | 2336 | ||
2336 | m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); | 2337 | m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); |
2337 | } | 2338 | } |
2338 | 2339 | ||
2339 | /// <summary> | 2340 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 039e9a7..91e1f2c 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -407,7 +407,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
407 | // private static readonly log4net.ILog m_log | 407 | // private static readonly log4net.ILog m_log |
408 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 408 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
409 | 409 | ||
410 | public void addPendingDownload(int count) | 410 | public void AddPendingDownloads(int count) |
411 | { | 411 | { |
412 | m_pendingDownloads += count; | 412 | m_pendingDownloads += count; |
413 | if (m_pendingDownloads < 0) m_pendingDownloads = 0; | 413 | if (m_pendingDownloads < 0) m_pendingDownloads = 0; |
@@ -437,13 +437,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
437 | return lastReportedSimFPS; | 437 | return lastReportedSimFPS; |
438 | } | 438 | } |
439 | 439 | ||
440 | public void AddPacketsFromClientStats(int inPackets, int outPackets, int unAckedBytes) | 440 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) |
441 | { | 441 | { |
442 | AddInPackets(inPackets); | 442 | AddInPackets(inPackets); |
443 | AddOutPackets(outPackets); | 443 | AddOutPackets(outPackets); |
444 | AddunAckedBytes(unAckedBytes); | 444 | AddunAckedBytes(unAckedBytes); |
445 | |||
446 | } | 445 | } |
446 | |||
447 | public void AddAgentTime(int ms) | ||
448 | { | ||
449 | addFrameMS(ms); | ||
450 | addAgentMS(ms); | ||
451 | } | ||
447 | 452 | ||
448 | #endregion | 453 | #endregion |
449 | } | 454 | } |