diff options
author | Justin Clark-Casey (justincc) | 2012-10-23 01:50:05 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-23 01:52:10 +0100 |
commit | 4578ff74fec7500902f58fbdee6ce5a6b39601fb (patch) | |
tree | 5058ada18085a83ae8a76a791ba1052c7025b6d6 /OpenSim/Region/ClientStack | |
parent | minor: Get content type handler logger to log "unset" for the content type in... (diff) | |
download | opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.zip opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.tar.gz opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.tar.bz2 opensim-SC_OLD-4578ff74fec7500902f58fbdee6ce5a6b39601fb.tar.xz |
Add object count stats for new IncomingPacket and UDPPacketBuffer pools if they are enabled. Add count stats for existing LLUDP pool.
This introduces a pull stat type in addition to the push stat type.
A pull stat takes a method on construction which knows how to update the stat on request.
In this way, special interfaces for pull stat collection are not necessary.
Diffstat (limited to 'OpenSim/Region/ClientStack')
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | 14 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | 17 | ||||
-rw-r--r-- | OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs | 40 |
3 files changed, 65 insertions, 6 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs index 419de66..bcfd392 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLUDPServer.cs | |||
@@ -278,7 +278,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
278 | ThrottleRates = new ThrottleRates(configSource); | 278 | ThrottleRates = new ThrottleRates(configSource); |
279 | 279 | ||
280 | if (UsePools) | 280 | if (UsePools) |
281 | { | ||
281 | m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500); | 282 | m_incomingPacketPool = new Pool<IncomingPacket>(() => new IncomingPacket(), 500); |
283 | |||
284 | StatsManager.RegisterStat( | ||
285 | new Stat( | ||
286 | "IncomingPacketPoolCount", | ||
287 | "Objects within incoming packet pool", | ||
288 | "The number of objects currently stored within the incoming packet pool", | ||
289 | "", | ||
290 | "clientstack", | ||
291 | "packetpool", | ||
292 | StatType.Pull, | ||
293 | stat => stat.Value = m_incomingPacketPool.Count, | ||
294 | StatVerbosity.Debug)); | ||
295 | } | ||
282 | } | 296 | } |
283 | 297 | ||
284 | public void Start() | 298 | public void Start() |
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs index 6e6b3ef..18abfd6 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/OpenSimUDPBase.cs | |||
@@ -31,6 +31,7 @@ using System.Net.Sockets; | |||
31 | using System.Threading; | 31 | using System.Threading; |
32 | using log4net; | 32 | using log4net; |
33 | using OpenSim.Framework; | 33 | using OpenSim.Framework; |
34 | using OpenSim.Framework.Monitoring; | ||
34 | 35 | ||
35 | namespace OpenMetaverse | 36 | namespace OpenMetaverse |
36 | { | 37 | { |
@@ -107,9 +108,25 @@ namespace OpenMetaverse | |||
107 | public void StartInbound(int recvBufferSize, bool asyncPacketHandling) | 108 | public void StartInbound(int recvBufferSize, bool asyncPacketHandling) |
108 | { | 109 | { |
109 | if (UsePools) | 110 | if (UsePools) |
111 | { | ||
110 | m_pool = new Pool<UDPPacketBuffer>(() => new UDPPacketBuffer(), 500); | 112 | m_pool = new Pool<UDPPacketBuffer>(() => new UDPPacketBuffer(), 500); |
113 | |||
114 | StatsManager.RegisterStat( | ||
115 | new Stat( | ||
116 | "UDPPacketBufferPoolCount", | ||
117 | "Objects within the UDPPacketBuffer pool", | ||
118 | "The number of objects currently stored within the UDPPacketBuffer pool", | ||
119 | "", | ||
120 | "clientstack", | ||
121 | "packetpool", | ||
122 | StatType.Pull, | ||
123 | stat => stat.Value = m_pool.Count, | ||
124 | StatVerbosity.Debug)); | ||
125 | } | ||
111 | else | 126 | else |
127 | { | ||
112 | m_pool = null; | 128 | m_pool = null; |
129 | } | ||
113 | 130 | ||
114 | m_asyncPacketHandling = asyncPacketHandling; | 131 | m_asyncPacketHandling = asyncPacketHandling; |
115 | 132 | ||
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs index 2a3d14f..9f22fb4 100644 --- a/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/PacketPool.cs | |||
@@ -47,18 +47,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
47 | private PercentageStat m_packetsReusedStat = new PercentageStat( | 47 | private PercentageStat m_packetsReusedStat = new PercentageStat( |
48 | "PacketsReused", | 48 | "PacketsReused", |
49 | "Packets reused", | 49 | "Packets reused", |
50 | "Number of packets reused out of all requests to the packet pool", | ||
50 | "clientstack", | 51 | "clientstack", |
51 | "packetpool", | 52 | "packetpool", |
52 | StatVerbosity.Debug, | 53 | StatType.Push, |
53 | "Number of packets reused out of all requests to the packet pool"); | 54 | null, |
55 | StatVerbosity.Debug); | ||
54 | 56 | ||
55 | private PercentageStat m_blocksReusedStat = new PercentageStat( | 57 | private PercentageStat m_blocksReusedStat = new PercentageStat( |
56 | "BlocksReused", | 58 | "PacketDataBlocksReused", |
57 | "Blocks reused", | 59 | "Packet data blocks reused", |
60 | "Number of data blocks reused out of all requests to the packet pool", | ||
58 | "clientstack", | 61 | "clientstack", |
59 | "packetpool", | 62 | "packetpool", |
60 | StatVerbosity.Debug, | 63 | StatType.Push, |
61 | "Number of data blocks reused out of all requests to the packet pool"); | 64 | null, |
65 | StatVerbosity.Debug); | ||
62 | 66 | ||
63 | /// <summary> | 67 | /// <summary> |
64 | /// Pool of packets available for reuse. | 68 | /// Pool of packets available for reuse. |
@@ -88,6 +92,30 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
88 | { | 92 | { |
89 | StatsManager.RegisterStat(m_packetsReusedStat); | 93 | StatsManager.RegisterStat(m_packetsReusedStat); |
90 | StatsManager.RegisterStat(m_blocksReusedStat); | 94 | StatsManager.RegisterStat(m_blocksReusedStat); |
95 | |||
96 | StatsManager.RegisterStat( | ||
97 | new Stat( | ||
98 | "PacketsPoolCount", | ||
99 | "Objects within the packet pool", | ||
100 | "The number of objects currently stored within the packet pool", | ||
101 | "", | ||
102 | "clientstack", | ||
103 | "packetpool", | ||
104 | StatType.Pull, | ||
105 | stat => { lock (pool) { stat.Value = pool.Count; } }, | ||
106 | StatVerbosity.Debug)); | ||
107 | |||
108 | StatsManager.RegisterStat( | ||
109 | new Stat( | ||
110 | "PacketDataBlocksPoolCount", | ||
111 | "Objects within the packet data block pool", | ||
112 | "The number of objects currently stored within the packet data block pool", | ||
113 | "", | ||
114 | "clientstack", | ||
115 | "packetpool", | ||
116 | StatType.Pull, | ||
117 | stat => { lock (DataBlocks) { stat.Value = DataBlocks.Count; } }, | ||
118 | StatVerbosity.Debug)); | ||
91 | } | 119 | } |
92 | 120 | ||
93 | /// <summary> | 121 | /// <summary> |