From 5146cb7a72d7f41dd9a3c022b48a75138259d977 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Fri, 3 Apr 2009 17:14:51 +0000 Subject: * 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 --- .../Agent/TextureDownload/TextureDownloadModule.cs | 2 +- .../TextureDownload/UserTextureDownloadService.cs | 2 +- OpenSim/Region/Framework/Scenes/Scene.cs | 28 ++-------------------- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 27 +++++++++++---------- .../Region/Framework/Scenes/SimStatsReporter.cs | 11 ++++++--- 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 { sender.Sending = false; //m_log.DebugFormat("[TEXTURE]: Removing download stat for {0}", sender.assetID); - m_scene.AddPendingDownloads(-1); + m_scene.StatsReporter.AddPendingDownloads(-1); } } } 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 return; } - m_scene.AddPendingDownloads(1); + m_scene.StatsReporter.AddPendingDownloads(1); TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber); 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 client.OnUnackedTerrain += TerrainUnAcked; client.OnObjectOwner += ObjectOwner; - IGodsModule godsModule = RequestModuleInterface(); + IGodsModule godsModule = RequestModuleInterface(); client.OnGodKickUser += godsModule.KickUser; client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; - if (StatsReporter != null) - client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats; + client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats; // EventManager.TriggerOnNewClient(client); } @@ -2793,29 +2792,6 @@ namespace OpenSim.Region.Framework.Scenes m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); } - public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes) - { - StatsReporter.AddInPackets(inPackets); - StatsReporter.AddOutPackets(outPackets); - StatsReporter.AddunAckedBytes(unAckedBytes); - } - - public void AddAgentTime(int ms) - { - StatsReporter.addFrameMS(ms); - StatsReporter.addAgentMS(ms); - } - - public void AddAgentUpdates(int count) - { - StatsReporter.AddAgentUpdates(count); - } - - public void AddPendingDownloads(int count) - { - StatsReporter.addPendingDownload(count); - } - #endregion 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 break; } - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); } #region Status Methods @@ -1382,7 +1382,7 @@ namespace OpenSim.Region.Framework.Scenes m_scene.EventManager.TriggerOnClientMovement(this); - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); } public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client) @@ -2068,7 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes newVelocity.Z = direc.Z; m_forcesList.Add(newVelocity); - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); } #endregion @@ -2140,8 +2140,8 @@ namespace OpenSim.Region.Framework.Scenes remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), new Vector3(vel.X, vel.Y, vel.Z), rot); - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); - m_scene.AddAgentUpdates(1); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentUpdates(1); } } @@ -2158,7 +2158,7 @@ namespace OpenSim.Region.Framework.Scenes lastPhysPos = AbsolutePosition; lastPhysRot = m_bodyRot; - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); } @@ -2199,7 +2199,7 @@ namespace OpenSim.Region.Framework.Scenes m_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations); - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); } public void CoarseLocationChange() @@ -2231,7 +2231,7 @@ namespace OpenSim.Region.Framework.Scenes remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, m_pos, m_appearance.Texture.GetBytes(), m_parentID, rot); - m_scene.AddAgentUpdates(1); + m_scene.StatsReporter.AddAgentUpdates(1); } /// @@ -2260,8 +2260,9 @@ namespace OpenSim.Region.Framework.Scenes } } } - m_scene.AddAgentUpdates(avatars.Count); - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + + m_scene.StatsReporter.AddAgentUpdates(avatars.Count); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); //SendAnimPack(); } @@ -2277,8 +2278,8 @@ namespace OpenSim.Region.Framework.Scenes SendFullUpdateToOtherClient(avatar); } - m_scene.AddAgentUpdates(avatars.Count); - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentUpdates(avatars.Count); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); SendAnimPack(); } @@ -2333,7 +2334,7 @@ namespace OpenSim.Region.Framework.Scenes } }); - m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); + m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS); } /// 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 // private static readonly log4net.ILog m_log // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); - public void addPendingDownload(int count) + public void AddPendingDownloads(int count) { m_pendingDownloads += count; if (m_pendingDownloads < 0) m_pendingDownloads = 0; @@ -437,13 +437,18 @@ namespace OpenSim.Region.Framework.Scenes return lastReportedSimFPS; } - public void AddPacketsFromClientStats(int inPackets, int outPackets, int unAckedBytes) + public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) { AddInPackets(inPackets); AddOutPackets(outPackets); AddunAckedBytes(unAckedBytes); - } + + public void AddAgentTime(int ms) + { + addFrameMS(ms); + addAgentMS(ms); + } #endregion } -- cgit v1.1