From 8efe4bfc2ed7086e9fdf4812297e6525f955f6ac Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Mon, 29 Jul 2013 23:18:29 +0100
Subject: Make "abnormal thread terminations" into
"ClientLogoutsDueToNoReceives" and add this to the StatsManager
This reflects the actual use of this stat - it hasn't recorded general exceptions for some time.
Make the sim extra stats collector draw the data from the stats manager rather than maintaing this data itself.
---
.../Framework/Monitoring/SimExtraStatsCollector.cs | 25 +++------
OpenSim/Framework/Monitoring/StatsManager.cs | 65 ++++++++++++++++++++--
2 files changed, 68 insertions(+), 22 deletions(-)
(limited to 'OpenSim/Framework')
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
index 6a68322..f6f458d 100644
--- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
using OpenMetaverse;
using OpenMetaverse.StructuredData;
@@ -39,8 +40,6 @@ namespace OpenSim.Framework.Monitoring
///
public class SimExtraStatsCollector : BaseStatsCollector
{
- private long abnormalClientThreadTerminations;
-
// private long assetsInCache;
// private long texturesInCache;
// private long assetCacheMemoryUsage;
@@ -73,11 +72,6 @@ namespace OpenSim.Framework.Monitoring
private volatile float activeScripts;
private volatile float scriptLinesPerSecond;
- ///
- /// Number of times that a client thread terminated because of an exception
- ///
- public long AbnormalClientThreadTerminations { get { return abnormalClientThreadTerminations; } }
-
// ///
// /// These statistics are being collected by push rather than pull. Pull would be simpler, but I had the
// /// notion of providing some flow statistics (which pull wouldn't give us). Though admittedly these
@@ -166,11 +160,6 @@ namespace OpenSim.Framework.Monitoring
private IDictionary packetQueueStatsCollectors
= new Dictionary();
- public void AddAbnormalClientThreadTermination()
- {
- abnormalClientThreadTerminations++;
- }
-
// public void AddAsset(AssetBase asset)
// {
// assetsInCache++;
@@ -324,10 +313,12 @@ Asset service request failures: {3}" + Environment.NewLine,
sb.Append(Environment.NewLine);
sb.Append("CONNECTION STATISTICS");
sb.Append(Environment.NewLine);
- sb.Append(
- string.Format(
- "Abnormal client thread terminations: {0}" + Environment.NewLine,
- abnormalClientThreadTerminations));
+
+ List stats = StatsManager.GetStatsFromEachContainer("clientstack", "ClientLogoutsDueToNoReceives");
+
+ sb.AppendFormat(
+ "Client logouts due to no data receive timeout: {0}\n\n",
+ stats != null ? stats.Sum(s => s.Value).ToString() : "unknown");
// sb.Append(Environment.NewLine);
// sb.Append("INVENTORY STATISTICS");
@@ -338,7 +329,7 @@ Asset service request failures: {3}" + Environment.NewLine,
// InventoryServiceRetrievalFailures));
sb.Append(Environment.NewLine);
- sb.Append("FRAME STATISTICS");
+ sb.Append("SAMPLE FRAME STATISTICS");
sb.Append(Environment.NewLine);
sb.Append("Dilatn SimFPS PhyFPS AgntUp RootAg ChldAg Prims AtvPrm AtvScr ScrLPS");
sb.Append(Environment.NewLine);
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index a5b54c9..e6a2304 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -271,7 +271,7 @@ namespace OpenSim.Framework.Monitoring
// Stat name is not unique across category/container/shortname key.
// XXX: For now just return false. This is to avoid problems in regression tests where all tests
// in a class are run in the same instance of the VM.
- if (TryGetStat(stat, out category, out container))
+ if (TryGetStatParents(stat, out category, out container))
return false;
// We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
@@ -307,7 +307,7 @@ namespace OpenSim.Framework.Monitoring
lock (RegisteredStats)
{
- if (!TryGetStat(stat, out category, out container))
+ if (!TryGetStatParents(stat, out category, out container))
return false;
newContainer = new SortedDictionary(container);
@@ -323,12 +323,67 @@ namespace OpenSim.Framework.Monitoring
}
}
- public static bool TryGetStats(string category, out SortedDictionary> stats)
+ public static bool TryGetStat(string category, string container, string statShortName, out Stat stat)
{
- return RegisteredStats.TryGetValue(category, out stats);
+ stat = null;
+ SortedDictionary> categoryStats;
+
+ lock (RegisteredStats)
+ {
+ if (!TryGetStatsForCategory(category, out categoryStats))
+ return false;
+
+ SortedDictionary containerStats;
+
+ if (!categoryStats.TryGetValue(container, out containerStats))
+ return false;
+
+ return containerStats.TryGetValue(statShortName, out stat);
+ }
+ }
+
+ public static bool TryGetStatsForCategory(
+ string category, out SortedDictionary> stats)
+ {
+ lock (RegisteredStats)
+ return RegisteredStats.TryGetValue(category, out stats);
+ }
+
+ ///
+ /// Get the same stat for each container in a given category.
+ ///
+ ///
+ /// The stats if there were any to fetch. Otherwise null.
+ ///
+ ///
+ ///
+ public static List GetStatsFromEachContainer(string category, string statShortName)
+ {
+ SortedDictionary> categoryStats;
+
+ lock (RegisteredStats)
+ {
+ if (!RegisteredStats.TryGetValue(category, out categoryStats))
+ return null;
+
+ List stats = null;
+
+ foreach (SortedDictionary containerStats in categoryStats.Values)
+ {
+ if (containerStats.ContainsKey(statShortName))
+ {
+ if (stats == null)
+ stats = new List();
+
+ stats.Add(containerStats[statShortName]);
+ }
+ }
+
+ return stats;
+ }
}
- public static bool TryGetStat(
+ public static bool TryGetStatParents(
Stat stat,
out SortedDictionary> category,
out SortedDictionary container)
--
cgit v1.1