aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-10-04 00:32:42 +0100
committerJustin Clark-Casey (justincc)2012-10-04 00:32:42 +0100
commite717398f6c72bdb30e59468462f3a5f589c1bb35 (patch)
tree0b917b2ee0670c72d8e8897c18e7f9bcd87dd92d /OpenSim/Region/Framework/Scenes
parentSoliciting for comments on smoothness of physics objects for this build. (diff)
downloadopensim-SC-e717398f6c72bdb30e59468462f3a5f589c1bb35.zip
opensim-SC-e717398f6c72bdb30e59468462f3a5f589c1bb35.tar.gz
opensim-SC-e717398f6c72bdb30e59468462f3a5f589c1bb35.tar.bz2
opensim-SC-e717398f6c72bdb30e59468462f3a5f589c1bb35.tar.xz
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.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs33
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 96317c3..b7b5ea2 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -47,6 +47,7 @@ namespace OpenSim.Region.Framework.Scenes
47 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 47 = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
48 48
49 public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates"; 49 public const string LastReportedObjectUpdateStatName = "LastReportedObjectUpdates";
50 public const string SlowFramesStatName = "SlowFrames";
50 51
51 public delegate void SendStatResult(SimStats stats); 52 public delegate void SendStatResult(SimStats stats);
52 53
@@ -129,6 +130,16 @@ namespace OpenSim.Region.Framework.Scenes
129 } 130 }
130 131
131 /// <summary> 132 /// <summary>
133 /// Number of frames that have taken longer to process than Scene.MIN_FRAME_TIME
134 /// </summary>
135 public Stat SlowFramesStat { get; private set; }
136
137 /// <summary>
138 /// The threshold at which we log a slow frame.
139 /// </summary>
140 public int SlowFramesStatReportThreshold { get; private set; }
141
142 /// <summary>
132 /// Extra sim statistics that are used by monitors but not sent to the client. 143 /// Extra sim statistics that are used by monitors but not sent to the client.
133 /// </summary> 144 /// </summary>
134 /// <value> 145 /// <value>
@@ -225,6 +236,22 @@ namespace OpenSim.Region.Framework.Scenes
225 236
226 if (StatsManager.SimExtraStats != null) 237 if (StatsManager.SimExtraStats != null)
227 OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; 238 OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket;
239
240 /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
241 /// longer than ideal (which in itself is a concern).
242 SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2);
243
244 SlowFramesStat
245 = new Stat(
246 "SlowFrames",
247 "Slow Frames",
248 "frames",
249 "scene",
250 m_scene.Name,
251 StatVerbosity.Info,
252 "Number of frames where frame time has been significantly longer than the desired frame time.");
253
254 StatsManager.RegisterStat(SlowFramesStat);
228 } 255 }
229 256
230 public void Close() 257 public void Close()
@@ -418,6 +445,7 @@ namespace OpenSim.Region.Framework.Scenes
418 lock (m_lastReportedExtraSimStats) 445 lock (m_lastReportedExtraSimStats)
419 { 446 {
420 m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; 447 m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
448 m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
421 449
422 Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); 450 Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
423 451
@@ -535,6 +563,11 @@ namespace OpenSim.Region.Framework.Scenes
535 public void addFrameMS(int ms) 563 public void addFrameMS(int ms)
536 { 564 {
537 m_frameMS += ms; 565 m_frameMS += ms;
566
567 // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit
568 // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern).
569 if (ms > SlowFramesStatReportThreshold)
570 SlowFramesStat.Value++;
538 } 571 }
539 572
540 public void AddSpareMS(int ms) 573 public void AddSpareMS(int ms)