diff options
author | Justin Clarke Casey | 2008-02-22 20:50:30 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-02-22 20:50:30 +0000 |
commit | 30eea2618dcc0a43d1d4d764590100c19bd7c05d (patch) | |
tree | 95d743afebbc8310ba15949131ab11a1d52c21fa /OpenSim/Region | |
parent | Some misplaced code made scripts never start :) (diff) | |
download | opensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.zip opensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.tar.gz opensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.tar.bz2 opensim-SC_OLD-30eea2618dcc0a43d1d4d764590100c19bd7c05d.tar.xz |
* Implement packet queue statistics
* This will show the packets waiting in each queue for each client logged into a region server
* These are displayed using 'show stats' on the region command line
* This is in pursuit of a memory leak.
* This will require a prebuild
Diffstat (limited to 'OpenSim/Region')
-rw-r--r-- | OpenSim/Region/ClientStack/ClientView.cs | 2 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/PacketQueue.cs | 37 |
2 files changed, 36 insertions, 3 deletions
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 2cedc81..8bdbe89 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -317,7 +317,7 @@ namespace OpenSim.Region.ClientStack | |||
317 | // in it to process. It's an on-purpose threadlock though because | 317 | // in it to process. It's an on-purpose threadlock though because |
318 | // without it, the clientloop will suck up all sim resources. | 318 | // without it, the clientloop will suck up all sim resources. |
319 | 319 | ||
320 | m_packetQueue = new PacketQueue(); | 320 | m_packetQueue = new PacketQueue(agentId); |
321 | 321 | ||
322 | RegisterLocalPacketHandlers(); | 322 | RegisterLocalPacketHandlers(); |
323 | 323 | ||
diff --git a/OpenSim/Region/ClientStack/PacketQueue.cs b/OpenSim/Region/ClientStack/PacketQueue.cs index 06ed32e..4673082 100644 --- a/OpenSim/Region/ClientStack/PacketQueue.cs +++ b/OpenSim/Region/ClientStack/PacketQueue.cs | |||
@@ -29,13 +29,16 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Threading; | 30 | using System.Threading; |
31 | using System.Timers; | 31 | using System.Timers; |
32 | using libsecondlife; | ||
32 | using libsecondlife.Packets; | 33 | using libsecondlife.Packets; |
33 | using OpenSim.Framework; | 34 | using OpenSim.Framework; |
35 | using OpenSim.Framework.Statistics; | ||
36 | using OpenSim.Framework.Statistics.Interfaces; | ||
34 | using Timer=System.Timers.Timer; | 37 | using Timer=System.Timers.Timer; |
35 | 38 | ||
36 | namespace OpenSim.Region.ClientStack | 39 | namespace OpenSim.Region.ClientStack |
37 | { | 40 | { |
38 | public class PacketQueue | 41 | public class PacketQueue : IPullStatsProvider |
39 | { | 42 | { |
40 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | 43 | //private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); |
41 | 44 | ||
@@ -76,8 +79,10 @@ namespace OpenSim.Region.ClientStack | |||
76 | // private long LastThrottle; | 79 | // private long LastThrottle; |
77 | // private long ThrottleInterval; | 80 | // private long ThrottleInterval; |
78 | private Timer throttleTimer; | 81 | private Timer throttleTimer; |
82 | |||
83 | private LLUUID m_agentId; | ||
79 | 84 | ||
80 | public PacketQueue() | 85 | public PacketQueue(LLUUID agentId) |
81 | { | 86 | { |
82 | // While working on this, the BlockingQueue had me fooled for a bit. | 87 | // While working on this, the BlockingQueue had me fooled for a bit. |
83 | // The Blocking queue causes the thread to stop until there's something | 88 | // The Blocking queue causes the thread to stop until there's something |
@@ -116,6 +121,13 @@ namespace OpenSim.Region.ClientStack | |||
116 | // TIMERS needed for this | 121 | // TIMERS needed for this |
117 | // LastThrottle = DateTime.Now.Ticks; | 122 | // LastThrottle = DateTime.Now.Ticks; |
118 | // ThrottleInterval = (long)(throttletimems/throttleTimeDivisor); | 123 | // ThrottleInterval = (long)(throttletimems/throttleTimeDivisor); |
124 | |||
125 | m_agentId = agentId; | ||
126 | |||
127 | if (StatsManager.SimExtraStats != null) | ||
128 | { | ||
129 | StatsManager.SimExtraStats.RegisterPacketQueueStatsProvider(m_agentId, this); | ||
130 | } | ||
119 | } | 131 | } |
120 | 132 | ||
121 | /* STANDARD QUEUE MANIPULATION INTERFACES */ | 133 | /* STANDARD QUEUE MANIPULATION INTERFACES */ |
@@ -214,6 +226,11 @@ namespace OpenSim.Region.ClientStack | |||
214 | { | 226 | { |
215 | m_enabled = false; | 227 | m_enabled = false; |
216 | throttleTimer.Stop(); | 228 | throttleTimer.Stop(); |
229 | |||
230 | if (StatsManager.SimExtraStats != null) | ||
231 | { | ||
232 | StatsManager.SimExtraStats.DeregisterPacketQueueStatsProvider(m_agentId); | ||
233 | } | ||
217 | } | 234 | } |
218 | 235 | ||
219 | private void ResetCounters() | 236 | private void ResetCounters() |
@@ -483,5 +500,21 @@ namespace OpenSim.Region.ClientStack | |||
483 | // effectively wiggling the slider causes things reset | 500 | // effectively wiggling the slider causes things reset |
484 | ResetCounters(); | 501 | ResetCounters(); |
485 | } | 502 | } |
503 | |||
504 | // See IPullStatsProvider | ||
505 | public string GetStats() | ||
506 | { | ||
507 | return string.Format("{0,7} {1,7} {2,7} {3,7} {4,7} {5,7} {6,7} {7,7} {8,7} {9,7}", | ||
508 | SendQueue.Count(), | ||
509 | IncomingPacketQueue.Count, | ||
510 | OutgoingPacketQueue.Count, | ||
511 | ResendOutgoingPacketQueue.Count, | ||
512 | LandOutgoingPacketQueue.Count, | ||
513 | WindOutgoingPacketQueue.Count, | ||
514 | CloudOutgoingPacketQueue.Count, | ||
515 | TaskOutgoingPacketQueue.Count, | ||
516 | TextureOutgoingPacketQueue.Count, | ||
517 | AssetOutgoingPacketQueue.Count); | ||
518 | } | ||
486 | } | 519 | } |
487 | } | 520 | } |