From 7bf628ab31028ac2118e43fbb9b9d0a77ea0f55f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 21 Mar 2012 00:02:08 +0000 Subject: Add ability to log warn if a frame takes longer than twice the expected time. Currently commented out. --- OpenSim/Region/Framework/Scenes/Scene.cs | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 1bea14f..790ec63 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -190,7 +190,11 @@ namespace OpenSim.Region.Framework.Scenes private int backupMS; private int terrainMS; private int landMS; - private int lastCompletedFrame; + + /// + /// Tick at which the last frame was processed. + /// + private int m_lastFrameTick; /// /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched @@ -464,7 +468,7 @@ namespace OpenSim.Region.Framework.Scenes public int MonitorBackupTime { get { return backupMS; } } public int MonitorTerrainTime { get { return terrainMS; } } public int MonitorLandTime { get { return landMS; } } - public int MonitorLastFrameTick { get { return lastCompletedFrame; } } + public int MonitorLastFrameTick { get { return m_lastFrameTick; } } public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get { return m_priorityScheme; } } public bool IsReprioritizationEnabled { get { return m_reprioritizationEnabled; } } @@ -1202,6 +1206,7 @@ namespace OpenSim.Region.Framework.Scenes float physicsFPS = 0f; int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; + int previousFrameTick; int maintc; List coarseLocations; List avatarUUIDs; @@ -1305,10 +1310,9 @@ namespace OpenSim.Region.Framework.Scenes // UpdateLand(); // landMS = Util.EnvironmentTickCountSubtract(ldMS); //} - + frameMS = Util.EnvironmentTickCountSubtract(maintc); otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; - lastCompletedFrame = Util.EnvironmentTickCount(); // if (Frame%m_update_avatars == 0) // UpdateInWorldTime(); @@ -1378,16 +1382,19 @@ namespace OpenSim.Region.Framework.Scenes // Tell the watchdog that this thread is still alive Watchdog.UpdateThread(); - maintc = Util.EnvironmentTickCountSubtract(maintc); +// previousFrameTick = m_lastFrameTick; + m_lastFrameTick = Util.EnvironmentTickCount(); + maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); maintc = (int)(MinFrameTime * 1000) - maintc; if (maintc > 0) Thread.Sleep(maintc); -// if (frameMS > (int)(MinFrameTime * 1000)) + // Optionally warn if a frame takes double the amount of time that it should. +// if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) // m_log.WarnFormat( // "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", -// frameMS, +// Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), // MinFrameTime * 1000, // RegionInfo.RegionName); } -- cgit v1.1