From 88b2fc61ff5e9a190d306a784839ad1ed1b30a8f Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 19 Aug 2014 00:42:19 +0100
Subject: Add clientstack.<scene>.OQRERequestsWaiting stat

Only present if OQRE is enabled
---
 .../Linden/UDP/OutgoingQueueRefillEngine.cs           | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

(limited to 'OpenSim')

diff --git a/OpenSim/Region/ClientStack/Linden/UDP/OutgoingQueueRefillEngine.cs b/OpenSim/Region/ClientStack/Linden/UDP/OutgoingQueueRefillEngine.cs
index 8777402..0659d8e 100644
--- a/OpenSim/Region/ClientStack/Linden/UDP/OutgoingQueueRefillEngine.cs
+++ b/OpenSim/Region/ClientStack/Linden/UDP/OutgoingQueueRefillEngine.cs
@@ -74,6 +74,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 
         private LLUDPServer m_udpServer;
 
+        private Stat m_oqreRequestsWaitingStat;
+
         /// <summary>
         /// Used to signal that we are ready to complete stop.
         /// </summary>
@@ -107,6 +109,21 @@ namespace OpenSim.Region.ClientStack.LindenUDP
 
                 m_requestQueue = new BlockingCollection<RefillRequest>(new ConcurrentQueue<RefillRequest>(), 5000);
 
+                m_oqreRequestsWaitingStat = 
+                    new Stat(
+                        "OQRERequestsWaiting",
+                        "Number of outgong queue refill requests waiting for processing.",
+                        "",
+                        "",
+                        "clientstack",
+                        m_udpServer.Scene.Name,
+                        StatType.Pull,
+                        MeasuresOfInterest.None,
+                        stat => stat.Value = m_requestQueue.Count,
+                        StatVerbosity.Debug);
+
+                StatsManager.RegisterStat(m_oqreRequestsWaitingStat);
+
                 Watchdog.StartThread(
                     ProcessRequests,
                     String.Format("OutgoingQueueRefillEngineThread ({0})", m_udpServer.Scene.Name),
@@ -161,6 +178,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
                 finally
                 {
                     m_cancelSource.Dispose();
+                    StatsManager.DeregisterStat(m_oqreRequestsWaitingStat);
+                    m_oqreRequestsWaitingStat = null;
                     m_requestQueue = null;
                 }
             }
-- 
cgit v1.1