diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs index c773c05905..338f2bb8d2 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs @@ -138,6 +138,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP /// whether or not to sleep private bool m_packetSent; + /// Environment.TickCount of the last time that packet stats were reported to the scene + private int m_elapsedMSSinceLastStatReport = 0; /// Environment.TickCount of the last time the outgoing packet handler executed private int m_tickLastOutgoingPacketHandler; /// Keeps track of the number of elapsed milliseconds since the last time the outgoing packet handler looped @@ -246,6 +248,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // Start the packet processing threads Watchdog.StartThread(IncomingPacketHandler, "Incoming Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); Watchdog.StartThread(OutgoingPacketHandler, "Outgoing Packets (" + m_scene.RegionInfo.RegionName + ")", ThreadPriority.Normal, false); + m_elapsedMSSinceLastStatReport = Environment.TickCount; } public new void Stop() @@ -716,6 +719,12 @@ namespace OpenSim.Region.ClientStack.LindenUDP // We don't need to do anything else with ping checks StartPingCheckPacket startPing = (StartPingCheckPacket)packet; CompletePing(udpClient, startPing.PingID.PingID); + + if ((Environment.TickCount - m_elapsedMSSinceLastStatReport) >= 3000) + { + udpClient.SendPacketStats(); + m_elapsedMSSinceLastStatReport = Environment.TickCount; + } return; } else if (packet.Type == PacketType.CompletePingCheck) diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 56c6ed62ea..3b5455fc34 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -238,7 +238,7 @@ namespace OpenSim.Region.Framework.Scenes sb[12].StatValue = m_otherMS / statsUpdateFactor; sb[13].StatID = (uint)Stats.InPacketsPerSecond; - sb[13].StatValue = (m_inPacketsPerSecond); + sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); sb[14].StatID = (uint)Stats.OutPacketsPerSecond; sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor); @@ -285,8 +285,8 @@ namespace OpenSim.Region.Framework.Scenes m_fps = 0; m_pfps = 0; m_agentUpdates = 0; - m_inPacketsPerSecond = 0; - m_outPacketsPerSecond = 0; + //m_inPacketsPerSecond = 0; + //m_outPacketsPerSecond = 0; m_unAckedBytes = 0; m_scriptLinesPerSecond = 0; @@ -373,12 +373,12 @@ namespace OpenSim.Region.Framework.Scenes public void AddInPackets(int numPackets) { - m_inPacketsPerSecond += numPackets; + m_inPacketsPerSecond = numPackets; } public void AddOutPackets(int numPackets) { - m_outPacketsPerSecond += numPackets; + m_outPacketsPerSecond = numPackets; } public void AddunAckedBytes(int numBytes)