diff options
author | Justin Clark-Casey (justincc) | 2012-10-04 01:27:40 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-10-04 01:27:40 +0100 |
commit | 3d36a6d55cb0bba408f5447d4596c12564366030 (patch) | |
tree | d7eaccf274aa68e7dedaba0f839646cf66ce8240 | |
parent | Add experimental "slow frames" stat, available in "show stats" and via the mo... (diff) | |
download | opensim-SC-3d36a6d55cb0bba408f5447d4596c12564366030.zip opensim-SC-3d36a6d55cb0bba408f5447d4596c12564366030.tar.gz opensim-SC-3d36a6d55cb0bba408f5447d4596c12564366030.tar.bz2 opensim-SC-3d36a6d55cb0bba408f5447d4596c12564366030.tar.xz |
Add generic PercentageStat.
Not yet used.
-rw-r--r-- | OpenSim/Framework/Monitoring/StatsManager.cs | 35 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 2 |
2 files changed, 34 insertions, 3 deletions
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 | |||
153 | public string ShortName { get; private set; } | 153 | public string ShortName { get; private set; } |
154 | public string Name { get; private set; } | 154 | public string Name { get; private set; } |
155 | public string Description { get; private set; } | 155 | public string Description { get; private set; } |
156 | public string UnitName { get; private set; } | 156 | public virtual string UnitName { get; private set; } |
157 | 157 | ||
158 | public double Value { get; set; } | 158 | public virtual double Value { get; set; } |
159 | 159 | ||
160 | public Stat( | 160 | public Stat( |
161 | string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description) | 161 | string shortName, string name, string unitName, string category, string container, StatVerbosity verbosity, string description) |
@@ -176,4 +176,35 @@ namespace OpenSim.Framework.Monitoring | |||
176 | return string.Format("{0}+{1}+{2}", container, category, shortName); | 176 | return string.Format("{0}+{1}+{2}", container, category, shortName); |
177 | } | 177 | } |
178 | } | 178 | } |
179 | |||
180 | public class PercentageStat : Stat | ||
181 | { | ||
182 | public int Antecedent { get; set; } | ||
183 | public int Consequent { get; set; } | ||
184 | |||
185 | public override double Value | ||
186 | { | ||
187 | get | ||
188 | { | ||
189 | int c = Consequent; | ||
190 | |||
191 | // Avoid any chance of a multi-threaded divide-by-zero | ||
192 | if (c == 0) | ||
193 | return 0; | ||
194 | |||
195 | return (double)Antecedent / c; | ||
196 | } | ||
197 | |||
198 | set | ||
199 | { | ||
200 | throw new Exception("Cannot set value on a PercentageStat"); | ||
201 | } | ||
202 | } | ||
203 | |||
204 | public PercentageStat( | ||
205 | string shortName, string name, string category, string container, StatVerbosity verbosity, string description) | ||
206 | : base(shortName, name, " %", category, container, verbosity, description) | ||
207 | { | ||
208 | } | ||
209 | } | ||
179 | } \ No newline at end of file | 210 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index b7b5ea2..2addb5b 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -245,7 +245,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
245 | = new Stat( | 245 | = new Stat( |
246 | "SlowFrames", | 246 | "SlowFrames", |
247 | "Slow Frames", | 247 | "Slow Frames", |
248 | "frames", | 248 | " frames", |
249 | "scene", | 249 | "scene", |
250 | m_scene.Name, | 250 | m_scene.Name, |
251 | StatVerbosity.Info, | 251 | StatVerbosity.Info, |