From e717398f6c72bdb30e59468462f3a5f589c1bb35 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Oct 2012 00:32:42 +0100
Subject: Add experimental "slow frames" stat, available in "show stats" and
via the monitoring module.
This increments a SlowFrames counter if a frame takes over 120% of maximum time.
This commit also introduces a generic OpenSim.Framework.Monitoring.Stat which is available to any code that wants to register a statistic.
This is more granualar than asking objects to create their own reports.
At some point this will supersede earlier IMonitor and IAlert facilities in MonitoringModule which are only available to scene code.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 114 +++++++++++++++++++++++++++
1 file changed, 114 insertions(+)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index d78fa6a..02df0ac 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -25,6 +25,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+using System;
+using System.Collections.Generic;
+
namespace OpenSim.Framework.Monitoring
{
///
@@ -32,6 +35,14 @@ namespace OpenSim.Framework.Monitoring
///
public class StatsManager
{
+ ///
+ /// Registered stats.
+ ///
+ ///
+ /// Do not add or remove from this dictionary.
+ ///
+ public static Dictionary RegisteredStats = new Dictionary();
+
private static AssetStatsCollector assetStats;
private static UserStatsCollector userStats;
private static SimExtraStatsCollector simExtraStats = new SimExtraStatsCollector();
@@ -61,5 +72,108 @@ namespace OpenSim.Framework.Monitoring
return userStats;
}
+
+ public static bool RegisterStat(Stat stat)
+ {
+ lock (RegisteredStats)
+ {
+ if (RegisteredStats.ContainsKey(stat.UniqueName))
+ {
+ // 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.
+ return false;
+
+// throw new Exception(
+// "StatsManager already contains stat with ShortName {0} in Category {1}", stat.ShortName, stat.Category);
+ }
+
+ // We take a replace-on-write approach here so that we don't need to generate a new Dictionary
+ Dictionary newRegisteredStats = new Dictionary(RegisteredStats);
+ newRegisteredStats[stat.UniqueName] = stat;
+ RegisteredStats = newRegisteredStats;
+ }
+
+ return true;
+ }
+
+ public static bool DeregisterStat(Stat stat)
+ {
+ lock (RegisteredStats)
+ {
+ if (!RegisteredStats.ContainsKey(stat.UniqueName))
+ return false;
+
+ Dictionary newRegisteredStats = new Dictionary(RegisteredStats);
+ newRegisteredStats.Remove(stat.UniqueName);
+ RegisteredStats = newRegisteredStats;
+
+ return true;
+ }
+ }
+ }
+
+ ///
+ /// Verbosity of stat.
+ ///
+ ///
+ /// Info will always be displayed.
+ ///
+ public enum StatVerbosity
+ {
+ Debug,
+ Info
+ }
+
+ ///
+ /// Holds individual static details
+ ///
+ public class Stat
+ {
+ ///
+ /// Unique stat name used for indexing. Each ShortName in a Category must be unique.
+ ///
+ public string UniqueName { get; private set; }
+
+ ///
+ /// Category of this stat (e.g. cache, scene, etc).
+ ///
+ public string Category { get; private set; }
+
+ ///
+ /// Containing name for this stat.
+ /// FIXME: In the case of a scene, this is currently the scene name (though this leaves
+ /// us with a to-be-resolved problem of non-unique region names).
+ ///
+ ///
+ /// The container.
+ ///
+ public string Container { get; private set; }
+
+ public StatVerbosity Verbosity { get; private set; }
+ public string ShortName { get; private set; }
+ public string Name { get; private set; }
+ public string Description { get; private set; }
+ public string UnitName { get; private set; }
+
+ public double Value { get; set; }
+
+ public Stat(
+ string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description)
+ {
+ ShortName = shortName;
+ Name = name;
+ UnitName = unitName;
+ Category = category;
+ Container = container;
+ Verbosity = verbosity;
+ Description = description;
+
+ UniqueName = GenUniqueName(Container, Category, ShortName);
+ }
+
+ public static string GenUniqueName(string container, string category, string shortName)
+ {
+ return string.Format("{0}+{1}+{2}", container, category, shortName);
+ }
}
}
\ No newline at end of file
--
cgit v1.1
From 3d36a6d55cb0bba408f5447d4596c12564366030 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 4 Oct 2012 01:27:40 +0100
Subject: Add generic PercentageStat.
Not yet used.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 35 ++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 02df0ac..b5dc24f 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -153,9 +153,9 @@ namespace OpenSim.Framework.Monitoring
public string ShortName { get; private set; }
public string Name { get; private set; }
public string Description { get; private set; }
- public string UnitName { get; private set; }
+ public virtual string UnitName { get; private set; }
- public double Value { get; set; }
+ public virtual double Value { get; set; }
public Stat(
string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description)
@@ -176,4 +176,35 @@ namespace OpenSim.Framework.Monitoring
return string.Format("{0}+{1}+{2}", container, category, shortName);
}
}
+
+ public class PercentageStat : Stat
+ {
+ public int Antecedent { get; set; }
+ public int Consequent { get; set; }
+
+ public override double Value
+ {
+ get
+ {
+ int c = Consequent;
+
+ // Avoid any chance of a multi-threaded divide-by-zero
+ if (c == 0)
+ return 0;
+
+ return (double)Antecedent / c;
+ }
+
+ set
+ {
+ throw new Exception("Cannot set value on a PercentageStat");
+ }
+ }
+
+ public PercentageStat(
+ string shortName, string name, string category, string container, StatVerbosity verbosity, string description)
+ : base(shortName, name, " %", category, container, verbosity, description)
+ {
+ }
+ }
}
\ No newline at end of file
--
cgit v1.1
From 1f2472d0fcd86a7ae09c01ecb3508eab001ce033 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Oct 2012 23:28:53 +0100
Subject: Extend "show stats" command to "show stats [list|all|]"
This allows different categories of stats to be shown, with options to list categories or show all stats.
Currently categories are scene and simulator and only a very few stats are currently registered via this mechanism.
This commit also adds percentage stats for packets and blocks reused from the packet pool.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 193 ++++++++++++++++++++++++---
1 file changed, 174 insertions(+), 19 deletions(-)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index b5dc24f..a67c5f8 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
+using OpenSim.Framework.Console;
namespace OpenSim.Framework.Monitoring
{
@@ -35,13 +36,23 @@ namespace OpenSim.Framework.Monitoring
///
public class StatsManager
{
+ // Subcommand used to list other stats.
+ public const string AllSubCommand = "all";
+
+ // Subcommand used to list other stats.
+ public const string ListSubCommand = "list";
+
+ // All subcommands
+ public static HashSet SubCommands = new HashSet { AllSubCommand, ListSubCommand };
+
///
- /// Registered stats.
+ /// Registered stats categorized by category/container/shortname
///
///
- /// Do not add or remove from this dictionary.
+ /// Do not add or remove directly from this dictionary.
///
- public static Dictionary RegisteredStats = new Dictionary();
+ public static Dictionary>> RegisteredStats
+ = new Dictionary>>();
private static AssetStatsCollector assetStats;
private static UserStatsCollector userStats;
@@ -51,6 +62,76 @@ namespace OpenSim.Framework.Monitoring
public static UserStatsCollector UserStats { get { return userStats; } }
public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
+ public static void RegisterConsoleCommands(CommandConsole console)
+ {
+ console.Commands.AddCommand(
+ "General",
+ false,
+ "show stats",
+ "show stats [list|all|]",
+ "Show statistical information for this server",
+ "If no final argument is specified then legacy statistics information is currently shown.\n"
+ + "If list is specified then statistic categories are shown.\n"
+ + "If all is specified then all registered statistics are shown.\n"
+ + "If a category name is specified then only statistics from that category are shown.\n"
+ + "THIS STATS FACILITY IS EXPERIMENTAL AND DOES NOT YET CONTAIN ALL STATS",
+ HandleShowStatsCommand);
+ }
+
+ public static void HandleShowStatsCommand(string module, string[] cmd)
+ {
+ ICommandConsole con = MainConsole.Instance;
+
+ if (cmd.Length > 2)
+ {
+ var categoryName = cmd[2];
+
+ if (categoryName == AllSubCommand)
+ {
+ foreach (var category in RegisteredStats.Values)
+ {
+ OutputCategoryStatsToConsole(con, category);
+ }
+ }
+ else if (categoryName == ListSubCommand)
+ {
+ con.Output("Statistic categories available are:");
+ foreach (string category in RegisteredStats.Keys)
+ con.OutputFormat(" {0}", category);
+ }
+ else
+ {
+ Dictionary> category;
+ if (!RegisteredStats.TryGetValue(categoryName, out category))
+ {
+ con.OutputFormat("No such category as {0}", categoryName);
+ }
+ else
+ {
+ OutputCategoryStatsToConsole(con, category);
+ }
+ }
+ }
+ else
+ {
+ // Legacy
+ con.Output(SimExtraStats.Report());
+ }
+ }
+
+ private static void OutputCategoryStatsToConsole(
+ ICommandConsole con, Dictionary> category)
+ {
+ foreach (var container in category.Values)
+ {
+ foreach (Stat stat in container.Values)
+ {
+ con.OutputFormat(
+ "{0}.{1}.{2} : {3}{4}", stat.Category, stat.Container, stat.ShortName, stat.Value, stat.UnitName);
+ }
+ }
+ }
+
///
/// Start collecting statistics related to assets.
/// Should only be called once.
@@ -73,43 +154,100 @@ namespace OpenSim.Framework.Monitoring
return userStats;
}
+ ///
+ /// Registers a statistic.
+ ///
+ ///
+ ///
public static bool RegisterStat(Stat stat)
{
+ Dictionary> category = null, newCategory;
+ Dictionary container = null, newContainer;
+
lock (RegisteredStats)
{
- if (RegisteredStats.ContainsKey(stat.UniqueName))
- {
- // 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.
+ // 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))
return false;
-// throw new Exception(
-// "StatsManager already contains stat with ShortName {0} in Category {1}", stat.ShortName, stat.Category);
- }
+ // We take a copy-on-write approach here of replacing dictionaries when keys are added or removed.
+ // This means that we don't need to lock or copy them on iteration, which will be a much more
+ // common operation after startup.
+ if (container != null)
+ newContainer = new Dictionary(container);
+ else
+ newContainer = new Dictionary();
+
+ if (category != null)
+ newCategory = new Dictionary>(category);
+ else
+ newCategory = new Dictionary>();
- // We take a replace-on-write approach here so that we don't need to generate a new Dictionary
- Dictionary newRegisteredStats = new Dictionary(RegisteredStats);
- newRegisteredStats[stat.UniqueName] = stat;
- RegisteredStats = newRegisteredStats;
+ newContainer[stat.ShortName] = stat;
+ newCategory[stat.Container] = newContainer;
+ RegisteredStats[stat.Category] = newCategory;
}
return true;
}
+ ///
+ /// Deregister a statistic
+ /// >
+ ///
+ /// > category = null, newCategory;
+ Dictionary container = null, newContainer;
+
lock (RegisteredStats)
{
- if (!RegisteredStats.ContainsKey(stat.UniqueName))
+ if (!TryGetStat(stat, out category, out container))
return false;
- Dictionary newRegisteredStats = new Dictionary(RegisteredStats);
- newRegisteredStats.Remove(stat.UniqueName);
- RegisteredStats = newRegisteredStats;
+ newContainer = new Dictionary(container);
+ newContainer.Remove(stat.UniqueName);
+
+ newCategory = new Dictionary>(category);
+ newCategory.Remove(stat.Container);
+
+ newCategory[stat.Container] = newContainer;
+ RegisteredStats[stat.Category] = newCategory;
return true;
}
}
+
+ public static bool TryGetStats(string category, out Dictionary> stats)
+ {
+ return RegisteredStats.TryGetValue(category, out stats);
+ }
+
+ public static bool TryGetStat(
+ Stat stat,
+ out Dictionary> category,
+ out Dictionary container)
+ {
+ category = null;
+ container = null;
+
+ lock (RegisteredStats)
+ {
+ if (RegisteredStats.TryGetValue(stat.Category, out category))
+ {
+ if (category.TryGetValue(stat.Container, out container))
+ {
+ if (container.ContainsKey(stat.ShortName))
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
}
///
@@ -157,9 +295,26 @@ namespace OpenSim.Framework.Monitoring
public virtual double Value { get; set; }
+ ///
+ /// Constructor
+ ///
+ /// Short name for the stat. Must not contain spaces. e.g. "LongFrames"
+ /// Human readable name for the stat. e.g. "Long frames"
+ ///
+ /// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
+ /// e.g. " frames"
+ ///
+ /// Category under which this stat should appear, e.g. "scene". Do not capitalize.
+ /// Entity to which this stat relates. e.g. scene name if this is a per scene stat.
+ /// Verbosity of stat. Controls whether it will appear in short stat display or only full display.
+ /// Description of stat
public Stat(
string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description)
{
+ if (StatsManager.SubCommands.Contains(category))
+ throw new Exception(
+ string.Format("Stat cannot be in category '{0}' since this is reserved for a subcommand", category));
+
ShortName = shortName;
Name = name;
UnitName = unitName;
@@ -203,7 +358,7 @@ namespace OpenSim.Framework.Monitoring
public PercentageStat(
string shortName, string name, string category, string container, StatVerbosity verbosity, string description)
- : base(shortName, name, " %", category, container, verbosity, description)
+ : base(shortName, name, "%", category, container, verbosity, description)
{
}
}
--
cgit v1.1
From 2e9ef015f7b73a3942011a36a9f94ce59d848dc0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Thu, 11 Oct 2012 23:58:37 +0100
Subject: Fix packetpool for ImprovedTerseObjectUpdate packets.
These were neither being returned or in many places reused.
Getting packets from a pool rather than deallocating and reallocating reduces memory churn which in turn reduces garbage collection time and frequency.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index a67c5f8..d365190 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -126,8 +126,7 @@ namespace OpenSim.Framework.Monitoring
{
foreach (Stat stat in container.Values)
{
- con.OutputFormat(
- "{0}.{1}.{2} : {3}{4}", stat.Category, stat.Container, stat.ShortName, stat.Value, stat.UnitName);
+ con.Output(stat.ToConsoleString());
}
}
}
@@ -330,6 +329,12 @@ namespace OpenSim.Framework.Monitoring
{
return string.Format("{0}+{1}+{2}", container, category, shortName);
}
+
+ public virtual string ToConsoleString()
+ {
+ return string.Format(
+ "{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName);
+ }
}
public class PercentageStat : Stat
@@ -358,8 +363,13 @@ namespace OpenSim.Framework.Monitoring
public PercentageStat(
string shortName, string name, string category, string container, StatVerbosity verbosity, string description)
- : base(shortName, name, "%", category, container, verbosity, description)
+ : base(shortName, name, "%", category, container, verbosity, description) {}
+
+ public override string ToConsoleString()
{
+ return string.Format(
+ "{0}.{1}.{2} : {3:0.###}{4} ({5}/{6})",
+ Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
}
}
}
\ No newline at end of file
--
cgit v1.1
From 387ce8ef35e7084895524507d6bba987b8c4a5d0 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 12 Oct 2012 00:10:51 +0100
Subject: Fix build break by moving OpenSim.Framework.Console back below
HttpServer in the build order.
Luckily, it turns out Framework.Monitoring doesn't need to reference Console directly.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index d365190..d7aff03 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -27,7 +27,6 @@
using System;
using System.Collections.Generic;
-using OpenSim.Framework.Console;
namespace OpenSim.Framework.Monitoring
{
@@ -62,7 +61,7 @@ namespace OpenSim.Framework.Monitoring
public static UserStatsCollector UserStats { get { return userStats; } }
public static SimExtraStatsCollector SimExtraStats { get { return simExtraStats; } }
- public static void RegisterConsoleCommands(CommandConsole console)
+ public static void RegisterConsoleCommands(ICommandConsole console)
{
console.Commands.AddCommand(
"General",
--
cgit v1.1
From 59a17ad676326d5affc2e221ef9c02166a85c6fd Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 12 Oct 2012 00:26:15 +0100
Subject: Fix percentage stats to multiply by 100. Adjust container name for
packetpool stats.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index d7aff03..31989e5 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -351,7 +351,7 @@ namespace OpenSim.Framework.Monitoring
if (c == 0)
return 0;
- return (double)Antecedent / c;
+ return (double)Antecedent / c * 100;
}
set
@@ -367,7 +367,7 @@ namespace OpenSim.Framework.Monitoring
public override string ToConsoleString()
{
return string.Format(
- "{0}.{1}.{2} : {3:0.###}{4} ({5}/{6})",
+ "{0}.{1}.{2} : {3:0.##}{4} ({5}/{6})",
Category, Container, ShortName, Value, UnitName, Antecedent, Consequent);
}
}
--
cgit v1.1
From 4578ff74fec7500902f58fbdee6ce5a6b39601fb Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 23 Oct 2012 01:50:05 +0100
Subject: 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.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 75 +++++++++++++++++++++++++---
1 file changed, 69 insertions(+), 6 deletions(-)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 31989e5..116b2c0 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -249,6 +249,19 @@ namespace OpenSim.Framework.Monitoring
}
///
+ /// Stat type.
+ ///
+ ///
+ /// A push stat is one which is continually updated and so it's value can simply by read.
+ /// A pull stat is one where reading the value triggers a collection method - the stat is not continually updated.
+ ///
+ public enum StatType
+ {
+ Push,
+ Pull
+ }
+
+ ///
/// Verbosity of stat.
///
///
@@ -285,29 +298,65 @@ namespace OpenSim.Framework.Monitoring
///
public string Container { get; private set; }
+ public StatType StatType { get; private set; }
+
+ ///
+ /// Action used to update this stat when the value is requested if it's a pull type.
+ ///
+ public Action PullAction { get; private set; }
+
public StatVerbosity Verbosity { get; private set; }
public string ShortName { get; private set; }
public string Name { get; private set; }
public string Description { get; private set; }
public virtual string UnitName { get; private set; }
- public virtual double Value { get; set; }
+ public virtual double Value
+ {
+ get
+ {
+ // Asking for an update here means that the updater cannot access this value without infinite recursion.
+ // XXX: A slightly messy but simple solution may be to flick a flag so we can tell if this is being
+ // called by the pull action and just return the value.
+ if (StatType == StatType.Pull)
+ PullAction(this);
+
+ return m_value;
+ }
+
+ set
+ {
+ m_value = value;
+ }
+ }
+
+ private double m_value;
///
/// Constructor
///
/// Short name for the stat. Must not contain spaces. e.g. "LongFrames"
/// Human readable name for the stat. e.g. "Long frames"
+ /// Description of stat
///
/// Unit name for the stat. Should be preceeded by a space if the unit name isn't normally appeneded immediately to the value.
/// e.g. " frames"
///
/// Category under which this stat should appear, e.g. "scene". Do not capitalize.
/// Entity to which this stat relates. e.g. scene name if this is a per scene stat.
+ /// Push or pull
+ /// Pull stats need an action to update the stat on request. Push stats should set null here.
/// Verbosity of stat. Controls whether it will appear in short stat display or only full display.
- /// Description of stat
public Stat(
- string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description)
+ string shortName,
+ string name,
+ string description,
+ string unitName,
+ string category,
+ string container,
+ StatType type,
+ Action pullAction,
+ StatVerbosity verbosity)
{
if (StatsManager.SubCommands.Contains(category))
throw new Exception(
@@ -315,11 +364,18 @@ namespace OpenSim.Framework.Monitoring
ShortName = shortName;
Name = name;
+ Description = description;
UnitName = unitName;
Category = category;
Container = container;
+ StatType = type;
+
+ if (StatType == StatType.Push && pullAction != null)
+ throw new Exception("A push stat cannot have a pull action");
+ else
+ PullAction = pullAction;
+
Verbosity = verbosity;
- Description = description;
UniqueName = GenUniqueName(Container, Category, ShortName);
}
@@ -361,8 +417,15 @@ namespace OpenSim.Framework.Monitoring
}
public PercentageStat(
- string shortName, string name, string category, string container, StatVerbosity verbosity, string description)
- : base(shortName, name, "%", category, container, verbosity, description) {}
+ string shortName,
+ string name,
+ string description,
+ string category,
+ string container,
+ StatType type,
+ Action pullAction,
+ StatVerbosity verbosity)
+ : base(shortName, name, description, "%", category, container, type, pullAction, verbosity) {}
public override string ToConsoleString()
{
--
cgit v1.1
From 319ebaca06db3d4a38beff74725d321b7c836157 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Tue, 23 Oct 2012 02:44:15 +0100
Subject: Make it possible to turn the base UDP object packet pools on and off
whilst running via the "debug lludp pool " console command. For
debug purposes.
This does not currently apply to the higher LLUDP packetpool.
---
OpenSim/Framework/Monitoring/StatsManager.cs | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
(limited to 'OpenSim/Framework/Monitoring/StatsManager.cs')
diff --git a/OpenSim/Framework/Monitoring/StatsManager.cs b/OpenSim/Framework/Monitoring/StatsManager.cs
index 116b2c0..4844336 100644
--- a/OpenSim/Framework/Monitoring/StatsManager.cs
+++ b/OpenSim/Framework/Monitoring/StatsManager.cs
@@ -207,7 +207,7 @@ namespace OpenSim.Framework.Monitoring
return false;
newContainer = new Dictionary(container);
- newContainer.Remove(stat.UniqueName);
+ newContainer.Remove(stat.ShortName);
newCategory = new Dictionary>(category);
newCategory.Remove(stat.Container);
@@ -279,11 +279,6 @@ namespace OpenSim.Framework.Monitoring
public class Stat
{
///
- /// Unique stat name used for indexing. Each ShortName in a Category must be unique.
- ///
- public string UniqueName { get; private set; }
-
- ///
/// Category of this stat (e.g. cache, scene, etc).
///
public string Category { get; private set; }
@@ -376,13 +371,6 @@ namespace OpenSim.Framework.Monitoring
PullAction = pullAction;
Verbosity = verbosity;
-
- UniqueName = GenUniqueName(Container, Category, ShortName);
- }
-
- public static string GenUniqueName(string container, string category, string shortName)
- {
- return string.Format("{0}+{1}+{2}", container, category, shortName);
}
public virtual string ToConsoleString()
--
cgit v1.1