* 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
0.6.5-rc1
Justin Clarke Casey 2009-04-03 17:14:51 +00:00
parent 7322e19212
commit 5146cb7a72
5 changed files with 26 additions and 44 deletions

View File

@ -291,7 +291,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
{ {
sender.Sending = false; sender.Sending = false;
//m_log.DebugFormat("[TEXTURE]: Removing download stat for {0}", sender.assetID); //m_log.DebugFormat("[TEXTURE]: Removing download stat for {0}", sender.assetID);
m_scene.AddPendingDownloads(-1); m_scene.StatsReporter.AddPendingDownloads(-1);
} }
} }
} }

View File

@ -147,7 +147,7 @@ namespace OpenSim.Region.CoreModules.Agent.TextureDownload
return; return;
} }
m_scene.AddPendingDownloads(1); m_scene.StatsReporter.AddPendingDownloads(1);
TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber); TextureSender.TextureSender requestHandler = new TextureSender.TextureSender(m_client, e.DiscardLevel, e.PacketNumber);
m_textureSenders.Add(e.RequestedAssetID, requestHandler); m_textureSenders.Add(e.RequestedAssetID, requestHandler);

View File

@ -1970,12 +1970,11 @@ namespace OpenSim.Region.Framework.Scenes
client.OnUnackedTerrain += TerrainUnAcked; client.OnUnackedTerrain += TerrainUnAcked;
client.OnObjectOwner += ObjectOwner; client.OnObjectOwner += ObjectOwner;
IGodsModule godsModule = RequestModuleInterface<IGodsModule>(); IGodsModule godsModule = RequestModuleInterface<IGodsModule>();
client.OnGodKickUser += godsModule.KickUser; client.OnGodKickUser += godsModule.KickUser;
client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers; client.OnRequestGodlikePowers += godsModule.RequestGodlikePowers;
if (StatsReporter != null) client.OnNetworkStatsUpdate += StatsReporter.AddPacketsStats;
client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats;
// EventManager.TriggerOnNewClient(client); // EventManager.TriggerOnNewClient(client);
} }
@ -2793,29 +2792,6 @@ namespace OpenSim.Region.Framework.Scenes
m_sceneGridService.RemoveUserFriend(ownerID, ExfriendID); 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 #endregion
public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set) public void HandleObjectPermissionsUpdate(IClientAPI controller, UUID agentID, UUID sessionID, byte field, uint localId, uint mask, byte set)

View File

@ -799,7 +799,7 @@ namespace OpenSim.Region.Framework.Scenes
break; break;
} }
m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
} }
#region Status Methods #region Status Methods
@ -1382,7 +1382,7 @@ namespace OpenSim.Region.Framework.Scenes
m_scene.EventManager.TriggerOnClientMovement(this); 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) public void DoAutoPilot(uint not_used, Vector3 Pos, IClientAPI remote_client)
@ -2068,7 +2068,7 @@ namespace OpenSim.Region.Framework.Scenes
newVelocity.Z = direc.Z; newVelocity.Z = direc.Z;
m_forcesList.Add(newVelocity); m_forcesList.Add(newVelocity);
m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
} }
#endregion #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), 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); new Vector3(vel.X, vel.Y, vel.Z), rot);
m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
m_scene.AddAgentUpdates(1); m_scene.StatsReporter.AddAgentUpdates(1);
} }
} }
@ -2158,7 +2158,7 @@ namespace OpenSim.Region.Framework.Scenes
lastPhysPos = AbsolutePosition; lastPhysPos = AbsolutePosition;
lastPhysRot = m_bodyRot; 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_controllingClient.SendCoarseLocationUpdate(AvatarUUIDs, CoarseLocations);
m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
} }
public void CoarseLocationChange() 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, remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
LocalId, m_pos, m_appearance.Texture.GetBytes(), LocalId, m_pos, m_appearance.Texture.GetBytes(),
m_parentID, rot); m_parentID, rot);
m_scene.AddAgentUpdates(1); m_scene.StatsReporter.AddAgentUpdates(1);
} }
/// <summary> /// <summary>
@ -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(); //SendAnimPack();
} }
@ -2277,8 +2278,8 @@ namespace OpenSim.Region.Framework.Scenes
SendFullUpdateToOtherClient(avatar); SendFullUpdateToOtherClient(avatar);
} }
m_scene.AddAgentUpdates(avatars.Count); m_scene.StatsReporter.AddAgentUpdates(avatars.Count);
m_scene.AddAgentTime(Environment.TickCount - m_perfMonMS); m_scene.StatsReporter.AddAgentTime(Environment.TickCount - m_perfMonMS);
SendAnimPack(); 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);
} }
/// <summary> /// <summary>

View File

@ -407,7 +407,7 @@ namespace OpenSim.Region.Framework.Scenes
// private static readonly log4net.ILog m_log // private static readonly log4net.ILog m_log
// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public void addPendingDownload(int count) public void AddPendingDownloads(int count)
{ {
m_pendingDownloads += count; m_pendingDownloads += count;
if (m_pendingDownloads < 0) m_pendingDownloads = 0; if (m_pendingDownloads < 0) m_pendingDownloads = 0;
@ -437,13 +437,18 @@ namespace OpenSim.Region.Framework.Scenes
return lastReportedSimFPS; return lastReportedSimFPS;
} }
public void AddPacketsFromClientStats(int inPackets, int outPackets, int unAckedBytes) public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
{ {
AddInPackets(inPackets); AddInPackets(inPackets);
AddOutPackets(outPackets); AddOutPackets(outPackets);
AddunAckedBytes(unAckedBytes); AddunAckedBytes(unAckedBytes);
} }
public void AddAgentTime(int ms)
{
addFrameMS(ms);
addAgentMS(ms);
}
#endregion #endregion
} }