aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-07-23 01:13:13 +0100
committerJustin Clark-Casey (justincc)2013-07-23 01:13:13 +0100
commit90528c23d991cd1fc77823be49e4135cf412b92e (patch)
tree0b49f7352355f800a7e71ef7f328abccbad0d082 /OpenSim
parentAdd proper method doc and comments to m_dataPresentEvent (from d9d9959) (diff)
downloadopensim-SC_OLD-90528c23d991cd1fc77823be49e4135cf412b92e.zip
opensim-SC_OLD-90528c23d991cd1fc77823be49e4135cf412b92e.tar.gz
opensim-SC_OLD-90528c23d991cd1fc77823be49e4135cf412b92e.tar.bz2
opensim-SC_OLD-90528c23d991cd1fc77823be49e4135cf412b92e.tar.xz
For stats which can show average change over time, show the last sample as well as the average.
This is somewhat cryptic at the moment, need to improve documentation.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/Monitoring/Stats/Stat.cs12
1 files changed, 11 insertions, 1 deletions
diff --git a/OpenSim/Framework/Monitoring/Stats/Stat.cs b/OpenSim/Framework/Monitoring/Stats/Stat.cs
index 9629b6e..cc2c947 100644
--- a/OpenSim/Framework/Monitoring/Stats/Stat.cs
+++ b/OpenSim/Framework/Monitoring/Stats/Stat.cs
@@ -253,6 +253,8 @@ namespace OpenSim.Framework.Monitoring
253 == MeasuresOfInterest.AverageChangeOverTime) 253 == MeasuresOfInterest.AverageChangeOverTime)
254 { 254 {
255 double totalChange = 0; 255 double totalChange = 0;
256 double lastChangeOverTime = 0;
257 double? penultimateSample = null;
256 double? lastSample = null; 258 double? lastSample = null;
257 259
258 lock (m_samples) 260 lock (m_samples)
@@ -266,13 +268,21 @@ namespace OpenSim.Framework.Monitoring
266 if (lastSample != null) 268 if (lastSample != null)
267 totalChange += s - (double)lastSample; 269 totalChange += s - (double)lastSample;
268 270
271 penultimateSample = lastSample;
269 lastSample = s; 272 lastSample = s;
270 } 273 }
271 } 274 }
272 275
276 if (lastSample != null && penultimateSample != null)
277 lastChangeOverTime = (double)lastSample - (double)penultimateSample;
278
273 int divisor = m_samples.Count <= 1 ? 1 : m_samples.Count - 1; 279 int divisor = m_samples.Count <= 1 ? 1 : m_samples.Count - 1;
274 280
275 sb.AppendFormat(", {0:0.##} {1}/s", totalChange / divisor / (Watchdog.WATCHDOG_INTERVAL_MS / 1000), UnitName); 281 double averageChangeOverTime = totalChange / divisor / (Watchdog.WATCHDOG_INTERVAL_MS / 1000);
282
283 sb.AppendFormat(
284 ", {0:0.##} {1}/s, {2:0.##} {3}/s",
285 lastChangeOverTime, UnitName, averageChangeOverTime, UnitName);
276 } 286 }
277 } 287 }
278 } 288 }