diff options
Diffstat (limited to 'OpenSim/Framework/Monitoring/Stats/Stat.cs')
-rw-r--r-- | OpenSim/Framework/Monitoring/Stats/Stat.cs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs index 9629b6e..ffd5132 100644 --- a/OpenSim/Framework/Monitoring/Stats/Stat.cs +++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs | |||
@@ -225,7 +225,13 @@ namespace OpenSim.Framework.Monitoring | |||
225 | public virtual string ToConsoleString() | 225 | public virtual string ToConsoleString() |
226 | { | 226 | { |
227 | StringBuilder sb = new StringBuilder(); | 227 | StringBuilder sb = new StringBuilder(); |
228 | sb.AppendFormat("{0}.{1}.{2} : {3} {4}", Category, Container, ShortName, Value, UnitName); | 228 | sb.AppendFormat( |
229 | "{0}.{1}.{2} : {3}{4}", | ||
230 | Category, | ||
231 | Container, | ||
232 | ShortName, | ||
233 | Value, | ||
234 | UnitName == null || UnitName == "" ? "" : string.Format(" {0}", UnitName)); | ||
229 | 235 | ||
230 | AppendMeasuresOfInterest(sb); | 236 | AppendMeasuresOfInterest(sb); |
231 | 237 | ||
@@ -253,6 +259,8 @@ namespace OpenSim.Framework.Monitoring | |||
253 | == MeasuresOfInterest.AverageChangeOverTime) | 259 | == MeasuresOfInterest.AverageChangeOverTime) |
254 | { | 260 | { |
255 | double totalChange = 0; | 261 | double totalChange = 0; |
262 | double lastChangeOverTime = 0; | ||
263 | double? penultimateSample = null; | ||
256 | double? lastSample = null; | 264 | double? lastSample = null; |
257 | 265 | ||
258 | lock (m_samples) | 266 | lock (m_samples) |
@@ -266,13 +274,25 @@ namespace OpenSim.Framework.Monitoring | |||
266 | if (lastSample != null) | 274 | if (lastSample != null) |
267 | totalChange += s - (double)lastSample; | 275 | totalChange += s - (double)lastSample; |
268 | 276 | ||
277 | penultimateSample = lastSample; | ||
269 | lastSample = s; | 278 | lastSample = s; |
270 | } | 279 | } |
271 | } | 280 | } |
272 | 281 | ||
282 | if (lastSample != null && penultimateSample != null) | ||
283 | lastChangeOverTime | ||
284 | = ((double)lastSample - (double)penultimateSample) / (Watchdog.WATCHDOG_INTERVAL_MS / 1000); | ||
285 | |||
273 | int divisor = m_samples.Count <= 1 ? 1 : m_samples.Count - 1; | 286 | int divisor = m_samples.Count <= 1 ? 1 : m_samples.Count - 1; |
274 | 287 | ||
275 | sb.AppendFormat(", {0:0.##} {1}/s", totalChange / divisor / (Watchdog.WATCHDOG_INTERVAL_MS / 1000), UnitName); | 288 | double averageChangeOverTime = totalChange / divisor / (Watchdog.WATCHDOG_INTERVAL_MS / 1000); |
289 | |||
290 | sb.AppendFormat( | ||
291 | ", {0:0.##}{1}/s, {2:0.##}{3}/s", | ||
292 | lastChangeOverTime, | ||
293 | UnitName == null || UnitName == "" ? "" : string.Format(" {0}", UnitName), | ||
294 | averageChangeOverTime, | ||
295 | UnitName == null || UnitName == "" ? "" : string.Format(" {0}", UnitName)); | ||
276 | } | 296 | } |
277 | } | 297 | } |
278 | } | 298 | } |