From 1848ceac955e3b41130edbd0cf33bdcc6186d9f8 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 24 Apr 2012 05:42:47 +0100 Subject: "save the catgirls" --- OpenSim/Region/Framework/Scenes/Scene.cs | 13 +++++++++---- OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 18 ++++-------------- 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'OpenSim/Region/Framework') diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 32a98b4..a9a4cda 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs @@ -1391,10 +1391,11 @@ namespace OpenSim.Region.Framework.Scenes int previousFrameTick; int maintc; int sleepMS; + int framestart; while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) { - maintc = Util.EnvironmentTickCount(); + framestart = Util.EnvironmentTickCount(); ++Frame; // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); @@ -1481,7 +1482,7 @@ namespace OpenSim.Region.Framework.Scenes // landMS = Util.EnvironmentTickCountSubtract(ldMS); //} - frameMS = Util.EnvironmentTickCountSubtract(maintc); + // frameMS = Util.EnvironmentTickCountSubtract(maintc); otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; // if (Frame%m_update_avatars == 0) @@ -1496,7 +1497,7 @@ namespace OpenSim.Region.Framework.Scenes // frameMS currently records work frame times, not total frame times (work + any required sleep to // reach min frame time. - StatsReporter.addFrameMS(frameMS); + // StatsReporter.addFrameMS(frameMS); StatsReporter.addAgentMS(agentMS); StatsReporter.addPhysicsMS(physicsMS + physicsMS2); @@ -1553,17 +1554,21 @@ namespace OpenSim.Region.Framework.Scenes previousFrameTick = m_lastFrameTick; m_lastFrameTick = Util.EnvironmentTickCount(); - maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); + maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); maintc = (int)(MinFrameTime * 1000) - maintc; m_firstHeartbeat = false; + sleepMS = Util.EnvironmentTickCount(); + if (maintc > 0) Thread.Sleep(maintc); sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); + frameMS = Util.EnvironmentTickCountSubtract(framestart); StatsReporter.addSleepMS(sleepMS); + StatsReporter.addFrameMS(frameMS); // Optionally warn if a frame takes double the amount of time that it should. if (DebugUpdates diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index e9589b8..94f1b15 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs @@ -253,24 +253,13 @@ namespace OpenSim.Region.Framework.Scenes physfps = 0; #endregion - - //Our time dilation is 0.91 when we're running a full speed, - // therefore to make sure we get an appropriate range, - // we have to factor in our error. (0.10f * statsUpdateFactor) - // multiplies the fix for the error times the amount of times it'll occur a second - // / 10 divides the value by the number of times the sim heartbeat runs (10fps) - // Then we divide the whole amount by the amount of seconds pass in between stats updates. - - // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change - // values to X-per-second values. - float factor = 1 / statsUpdateFactor; if (reportedFPS <= 0) reportedFPS = 1; float perframe = 1.0f / (float)reportedFPS; - float TotalFrameTime = 1000.0f * statsUpdateFactor * perframe; + float TotalFrameTime = m_frameMS * perframe; float targetframetime = 1100.0f / (float)m_nominalReportedFps; @@ -279,7 +268,8 @@ namespace OpenSim.Region.Framework.Scenes sparetime = 0; else { - sparetime = TotalFrameTime - m_frameMS * perframe; + sparetime = m_frameMS - m_physicsMS - m_agentMS; + sparetime *= perframe; if (sparetime < 0) sparetime = 0; else if (sparetime > TotalFrameTime) @@ -290,7 +280,7 @@ namespace OpenSim.Region.Framework.Scenes // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; // m_imageMS m_netMS are not included in m_frameMS - m_otherMS = m_frameMS - m_physicsMS - m_agentMS; + m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; if (m_otherMS < 0) m_otherMS = 0; -- cgit v1.1