Add scene.<scene-name>.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
0.8.0.3
Justin Clark-Casey (justincc) 2014-03-18 20:59:11 +00:00
parent 8ce3fa646b
commit a660c0a750
1 changed files with 42 additions and 16 deletions

View File

@ -74,9 +74,18 @@ namespace OpenSim.Region.ClientStack.Linden
/// </remarks> /// </remarks>
public bool ProcessQueuedRequestsAsync { get; private set; } public bool ProcessQueuedRequestsAsync { get; private set; }
private Stat m_queuedRequestsStat; /// <summary>
/// Number of inventory requests processed by this module.
/// </summary>
/// <remarks>
/// It's the PollServiceRequestManager that actually sends completed requests back to the requester.
/// </remarks>
public int ProcessedRequestsCount { get; set; }
private Scene m_scene; private Stat m_queuedRequestsStat;
private Stat m_processedRequestsStat;
public Scene Scene { get; private set; }
private IInventoryService m_InventoryService; private IInventoryService m_InventoryService;
private ILibraryService m_LibraryService; private ILibraryService m_LibraryService;
@ -122,7 +131,7 @@ namespace OpenSim.Region.ClientStack.Linden
if (!m_Enabled) if (!m_Enabled)
return; return;
m_scene = s; Scene = s;
} }
public void RemoveRegion(Scene s) public void RemoveRegion(Scene s)
@ -130,8 +139,9 @@ namespace OpenSim.Region.ClientStack.Linden
if (!m_Enabled) if (!m_Enabled)
return; return;
m_scene.EventManager.OnRegisterCaps -= RegisterCaps; Scene.EventManager.OnRegisterCaps -= RegisterCaps;
StatsManager.DeregisterStat(m_processedRequestsStat);
StatsManager.DeregisterStat(m_queuedRequestsStat); StatsManager.DeregisterStat(m_queuedRequestsStat);
if (ProcessQueuedRequestsAsync) if (ProcessQueuedRequestsAsync)
@ -145,7 +155,7 @@ namespace OpenSim.Region.ClientStack.Linden
} }
} }
m_scene = null; Scene = null;
} }
public void RegionLoaded(Scene s) public void RegionLoaded(Scene s)
@ -153,6 +163,19 @@ namespace OpenSim.Region.ClientStack.Linden
if (!m_Enabled) if (!m_Enabled)
return; 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 = m_queuedRequestsStat =
new Stat( new Stat(
"QueuedFetchInventoryRequests", "QueuedFetchInventoryRequests",
@ -160,21 +183,22 @@ namespace OpenSim.Region.ClientStack.Linden
"", "",
"", "",
"scene", "scene",
m_scene.Name, Scene.Name,
StatType.Pull, StatType.Pull,
MeasuresOfInterest.AverageChangeOverTime, MeasuresOfInterest.AverageChangeOverTime,
stat => { lock (m_queue) { stat.Value = m_queue.Count; } }, stat => { lock (m_queue) { stat.Value = m_queue.Count; } },
StatVerbosity.Debug); StatVerbosity.Debug);
StatsManager.RegisterStat(m_processedRequestsStat);
StatsManager.RegisterStat(m_queuedRequestsStat); StatsManager.RegisterStat(m_queuedRequestsStat);
m_InventoryService = m_scene.InventoryService; m_InventoryService = Scene.InventoryService;
m_LibraryService = m_scene.LibraryService; m_LibraryService = Scene.LibraryService;
// We'll reuse the same handler for all requests. // We'll reuse the same handler for all requests.
m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService); m_webFetchHandler = new WebFetchInvDescHandler(m_InventoryService, m_LibraryService);
m_scene.EventManager.OnRegisterCaps += RegisterCaps; Scene.EventManager.OnRegisterCaps += RegisterCaps;
if (ProcessQueuedRequestsAsync && m_workerThreads == null) if (ProcessQueuedRequestsAsync && m_workerThreads == null)
{ {
@ -215,12 +239,12 @@ namespace OpenSim.Region.ClientStack.Linden
private Dictionary<UUID, Hashtable> responses = private Dictionary<UUID, Hashtable> responses =
new Dictionary<UUID, Hashtable>(); new Dictionary<UUID, Hashtable>();
private Scene m_scene; private WebFetchInvDescModule m_module;
public PollServiceInventoryEventArgs(Scene scene, string url, UUID pId) : public PollServiceInventoryEventArgs(WebFetchInvDescModule module, string url, UUID pId) :
base(null, url, null, null, null, pId, int.MaxValue) base(null, url, null, null, null, pId, int.MaxValue)
{ {
m_scene = scene; m_module = module;
HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); }; HasEvents = (x, y) => { lock (responses) return responses.ContainsKey(x); };
GetEvents = (x, y) => GetEvents = (x, y) =>
@ -240,7 +264,7 @@ namespace OpenSim.Region.ClientStack.Linden
Request = (x, y) => Request = (x, y) =>
{ {
ScenePresence sp = m_scene.GetScenePresence(Id); ScenePresence sp = m_module.Scene.GetScenePresence(Id);
if (sp == null) if (sp == null)
{ {
m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id); m_log.ErrorFormat("[INVENTORY]: Unable to find ScenePresence for {0}", Id);
@ -340,6 +364,8 @@ namespace OpenSim.Region.ClientStack.Linden
lock (responses) lock (responses)
responses[requestID] = response; responses[requestID] = response;
m_module.ProcessedRequestsCount++;
} }
} }
@ -363,7 +389,7 @@ namespace OpenSim.Region.ClientStack.Linden
capUrl = "/CAPS/" + UUID.Random() + "/"; capUrl = "/CAPS/" + UUID.Random() + "/";
// Register this as a poll service // 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; args.Type = PollServiceEventArgs.EventType.Inventory;
caps.RegisterPollHandler(capName, args); caps.RegisterPollHandler(capName, args);
@ -372,7 +398,7 @@ namespace OpenSim.Region.ClientStack.Linden
else else
{ {
capUrl = url; capUrl = url;
IExternalCapsModule handler = m_scene.RequestModuleInterface<IExternalCapsModule>(); IExternalCapsModule handler = Scene.RequestModuleInterface<IExternalCapsModule>();
if (handler != null) if (handler != null)
handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl); handler.RegisterExternalUserCapsHandler(agentID,caps,capName,capUrl);
else else