mirror of
https://github.com/opensim/opensim.git
synced 2026-08-07 09:45:47 +08:00
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.
This commit is contained in:
@@ -31,6 +31,7 @@ using System.Net.Sockets;
|
||||
using System.Threading;
|
||||
using log4net;
|
||||
using OpenSim.Framework;
|
||||
using OpenSim.Framework.Monitoring;
|
||||
|
||||
namespace OpenMetaverse
|
||||
{
|
||||
@@ -107,9 +108,25 @@ namespace OpenMetaverse
|
||||
public void StartInbound(int recvBufferSize, bool asyncPacketHandling)
|
||||
{
|
||||
if (UsePools)
|
||||
{
|
||||
m_pool = new Pool<UDPPacketBuffer>(() => new UDPPacketBuffer(), 500);
|
||||
|
||||
StatsManager.RegisterStat(
|
||||
new Stat(
|
||||
"UDPPacketBufferPoolCount",
|
||||
"Objects within the UDPPacketBuffer pool",
|
||||
"The number of objects currently stored within the UDPPacketBuffer pool",
|
||||
"",
|
||||
"clientstack",
|
||||
"packetpool",
|
||||
StatType.Pull,
|
||||
stat => stat.Value = m_pool.Count,
|
||||
StatVerbosity.Debug));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_pool = null;
|
||||
}
|
||||
|
||||
m_asyncPacketHandling = asyncPacketHandling;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user