From 8296413add95ce2a56f308fa7e762196155dd028 Mon Sep 17 00:00:00 2001 From: "Teravus Ovares (Dan Olivares)" Date: Fri, 27 Nov 2009 19:17:36 -0500 Subject: [PATCH] * Re-enable lightweight packet tracking stats on a 3000 ms interval. --- OpenSim/Region/ClientStack/LindenUDP/LLUDPServer.cs | 9 +++++++++ OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 10 +++++----- 2 files changed, 14 insertions(+), 5 deletions(-) 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)