From a660c0a750db57683c34156dda51ac5fafd26f70 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 18 Mar 2014 20:59:11 +0000 Subject: Add scene..ProcessedFetchInventoryRequests This shows the number of requests that have been processed. These have not necessarily been sent back to the request since this is done separately by the PollServiceRequestManager --- .../Linden/Caps/WebFetchInvDescModule.cs | 56 ++++++++++++++++------ 1 file changed, 41 insertions(+), 15 deletions(-) (limited to 'OpenSim/Region') diff --git a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs index 2544c7f..94d3011 100644 --- a/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs +++ b/OpenSim/Region/ClientStack/Linden/Caps/WebFetchInvDescModule.cs @@ -74,9 +74,18 @@ namespace OpenSim.Region.ClientStack.Linden /// public bool ProcessQueuedRequestsAsync { get; private set; } + /// + /// Number of inventory requests processed by this module. + /// + /// + /// It's the PollServiceRequestManager that actually sends completed requests back to the requester. + /// + public int ProcessedRequestsCount { get; set; } + private Stat m_queuedRequestsStat; + private Stat m_processedRequestsStat; - private Scene m_scene; + public Scene Scene { get; private set; } private IInventoryService m_InventoryService; private ILibraryService m_LibraryService; @@ -122,7 +131,7 @@ namespace OpenSim.Region.ClientStack.Linden if (!m_Enabled) return; - m_scene = s; + Scene = s; } public void RemoveRegion(Scene s) @@ -130,8 +139,9 @@ namespace OpenSim.Region.ClientStack.Linden if (!m_Enabled) return; - m_scene.EventManager.OnRegisterCaps -= RegisterCaps; + Scene.EventManager.OnRegisterCaps -= RegisterCaps; + StatsManager.DeregisterStat(m_processedRequestsStat); StatsManager.DeregisterStat(m_queuedRequestsStat); if (ProcessQueuedRequestsAsync) @@ -145,7 +155,7 @@ namespace OpenSim.Region.ClientStack.Linden } } - m_scene = null; + Scene = null; } public void RegionLoaded(Scene s) @@ -153,6 +163,19 @@ namespace OpenSim.Region.ClientStack.Linden if (!m_Enabled) return; + m_processedRequestsStat = + new Stat( + "ProcessedFetchInventoryRequests", + "Number of processed fetch inventory requests", + "These have not necessarily yet been dispatched back to the requester.", + "", + "scene", + Scene.Name, + StatType.Pull, + MeasuresOfInterest.AverageChangeOverTime, + stat => { lock (m_queue) { stat.Value = ProcessedRequestsCount; } }, + StatVerbosity.Debug); + m_queuedRequestsStat = new Stat( "QueuedFetchInventoryRequests", @@ -160,21 +183,22 @@ namespace OpenSim.Region.ClientStack.Linden "", "", "scene", - m_scene.Name, + Scene.Name, StatType.Pull, MeasuresOfInterest.AverageChangeOverTime, stat => { lock (m_queue) { stat.Value = m_queue.Count; } }, StatVerbosity.Debug); + StatsManager.RegisterStat(m_processedRequestsStat); StatsManager.RegisterStat(m_queuedRequestsStat); - m_InventoryService = m_scene.InventoryService; - m_LibraryService = m_scene.LibraryService; + m_InventoryService = Scene.InventoryService; + m_LibraryService = Scene.LibraryService; // We'll reuse the same handler for all requests. m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); - m_scene.EventManager.OnRegisterCaps += RegisterCaps; + Scene.EventManager.OnRegisterCaps += RegisterCaps; if (ProcessQueuedRequestsAsync && m_workerThreads == null) { @@ -215,12 +239,12 @@ namespace OpenSim.Region.ClientStack.Linden private Dictionary responses = new Dictionary(); - private Scene m_scene; + private WebFetchInvDescModule m_module; - public PollServiceInventoryEventArgs(Scene scene, string url, UUID pId) : - base(null, url, null, null, null, pId, int.MaxValue) + public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) : + base(null, url, null, null, null, pId, int.MaxValue) { - m_scene = scene; + m_module = module; HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; GetEvents = (x, y) => @@ -240,7 +264,7 @@ namespace OpenSim.Region.ClientStack.Linden Request = (x, y) => { - ScenePresence sp = m_scene.GetScenePresence(Id); + ScenePresence sp = m_module.Scene.GetScenePresence(Id); if (sp == null) { m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id); @@ -340,6 +364,8 @@ namespace OpenSim.Region.ClientStack.Linden lock (responses) responses[requestID] = response; + + m_module.ProcessedRequestsCount++; } } @@ -363,7 +389,7 @@ namespace OpenSim.Region.ClientStack.Linden capUrl = "/CAPS/" + UUID.Random() + "/"; // Register this as a poll service - PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(m_scene, capUrl, agentID); + PollServiceInventoryEventArgs args = new PollServiceInventoryEventArgs(this, capUrl, agentID); args.Type = PollServiceEventArgs.EventType.Inventory; caps.RegisterPollHandler(capName, args); @@ -372,7 +398,7 @@ namespace OpenSim.Region.ClientStack.Linden else { capUrl = url; - IExternalCapsModule handler = m_scene.RequestModuleInterface(); + IExternalCapsModule handler = Scene.RequestModuleInterface(); if (handler != null) handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl); else -- cgit v1.1