diff options
Diffstat (limited to 'OpenSim/Framework/Monitoring/Stats/Stat.cs')
-rw-r--r-- | OpenSim/Framework/Monitoring/Stats/Stat.cs | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index f91251b..2e7665f 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs | |||
@@ -29,12 +29,14 @@ using System; | |||
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Text; | 30 | using System.Text; |
31 | 31 | ||
32 | using OpenMetaverse.StructuredData; | ||
33 | |||
32 | namespace OpenSim.Framework.Monitoring | 34 | namespace OpenSim.Framework.Monitoring |
33 | { | 35 | { |
34 | /// <summary> | 36 | /// <summary> |
35 | /// Holds individual statistic details | 37 | /// Holds individual statistic details |
36 | /// </summary> | 38 | /// </summary> |
37 | public class Stat | 39 | public class Stat : IDisposable |
38 | { | 40 | { |
39 | /// <summary> | 41 | /// <summary> |
40 | /// Category of this stat (e.g. cache, scene, etc). | 42 | /// Category of this stat (e.g. cache, scene, etc). |
@@ -181,6 +183,12 @@ namespace OpenSim.Framework.Monitoring | |||
181 | Verbosity = verbosity; | 183 | Verbosity = verbosity; |
182 | } | 184 | } |
183 | 185 | ||
186 | // IDisposable.Dispose() | ||
187 | public virtual void Dispose() | ||
188 | { | ||
189 | return; | ||
190 | } | ||
191 | |||
184 | /// <summary> | 192 | /// <summary> |
185 | /// Record a value in the sample set. | 193 | /// Record a value in the sample set. |
186 | /// </summary> | 194 | /// </summary> |
@@ -203,13 +211,27 @@ namespace OpenSim.Framework.Monitoring | |||
203 | public virtual string ToConsoleString() | 211 | public virtual string ToConsoleString() |
204 | { | 212 | { |
205 | StringBuilder sb = new StringBuilder(); | 213 | StringBuilder sb = new StringBuilder(); |
206 | sb.AppendFormat("{0}.{1}.{2} : {3}{4}", Category, Container, ShortName, Value, UnitName); | 214 | sb.AppendFormat("{0}.{1}.{2} : {3} {4}", Category, Container, ShortName, Value, UnitName); |
207 | 215 | ||
208 | AppendMeasuresOfInterest(sb); | 216 | AppendMeasuresOfInterest(sb); |
209 | 217 | ||
210 | return sb.ToString(); | 218 | return sb.ToString(); |
211 | } | 219 | } |
212 | 220 | ||
221 | public virtual OSDMap ToOSDMap() | ||
222 | { | ||
223 | OSDMap ret = new OSDMap(); | ||
224 | ret.Add("Category", OSD.FromString(Category)); | ||
225 | ret.Add("Container", OSD.FromString(Container)); | ||
226 | ret.Add("ShortName", OSD.FromString(ShortName)); | ||
227 | ret.Add("Name", OSD.FromString(Name)); | ||
228 | ret.Add("Description", OSD.FromString(Description)); | ||
229 | ret.Add("UnitName", OSD.FromString(UnitName)); | ||
230 | ret.Add("Value", OSD.FromReal(Value)); | ||
231 | |||
232 | return ret; | ||
233 | } | ||
234 | |||
213 | protected void AppendMeasuresOfInterest(StringBuilder sb) | 235 | protected void AppendMeasuresOfInterest(StringBuilder sb) |
214 | { | 236 | { |
215 | if ((MeasuresOfInterest & MeasuresOfInterest.AverageChangeOverTime) | 237 | if ((MeasuresOfInterest & MeasuresOfInterest.AverageChangeOverTime) |