diff options
Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SimStatsReporter.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 756b1f4..5398ab9 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> |
@@ -226,6 +237,24 @@ namespace OpenSim.Region.Framework.Scenes | |||
226 | 237 | ||
227 | if (StatsManager.SimExtraStats != null) | 238 | if (StatsManager.SimExtraStats != null) |
228 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; | 239 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; |
240 | |||
241 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | ||
242 | /// longer than ideal (which in itself is a concern). | ||
243 | SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); | ||
244 | |||
245 | SlowFramesStat | ||
246 | = new Stat( | ||
247 | "SlowFrames", | ||
248 | "Slow Frames", | ||
249 | "Number of frames where frame time has been significantly longer than the desired frame time.", | ||
250 | " frames", | ||
251 | "scene", | ||
252 | m_scene.Name, | ||
253 | StatType.Push, | ||
254 | null, | ||
255 | StatVerbosity.Info); | ||
256 | |||
257 | StatsManager.RegisterStat(SlowFramesStat); | ||
229 | } | 258 | } |
230 | 259 | ||
231 | public void Close() | 260 | public void Close() |
@@ -443,6 +472,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
443 | lock (m_lastReportedExtraSimStats) | 472 | lock (m_lastReportedExtraSimStats) |
444 | { | 473 | { |
445 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; | 474 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; |
475 | m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value; | ||
446 | 476 | ||
447 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | 477 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); |
448 | 478 | ||
@@ -563,6 +593,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
563 | public void addFrameMS(int ms) | 593 | public void addFrameMS(int ms) |
564 | { | 594 | { |
565 | m_frameMS += ms; | 595 | m_frameMS += ms; |
596 | |||
597 | // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | ||
598 | // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern). | ||
599 | if (ms > SlowFramesStatReportThreshold) | ||
600 | SlowFramesStat.Value++; | ||
566 | } | 601 | } |
567 | 602 | ||
568 | public void addNetMS(int ms) | 603 | public void addNetMS(int ms) |