some reduction on time resolution efects on spare time report

avinationmerge
UbitUmarov 2012-04-24 03:38:13 +01:00
parent b019b20eb8
commit f1d6b3e710
1 changed files with 8 additions and 4 deletions

View File

@ -267,22 +267,26 @@ namespace OpenSim.Region.Framework.Scenes
float factor = 1 / statsUpdateFactor; float factor = 1 / statsUpdateFactor;
if (reportedFPS <= 0) if (reportedFPS <= 0)
reportedFPS = 1; reportedFPS = 1;
float TotalFrameTime = 1000.0f * statsUpdateFactor / (float)reportedFPS;
float perframe = 1.0f / (float)reportedFPS; float perframe = 1.0f / (float)reportedFPS;
float TotalFrameTime = 1000.0f * statsUpdateFactor * perframe;
float targetframetime = 1100.0f / (float)m_nominalReportedFps;
float sparetime; float sparetime;
if (m_nominalReportedFps <= 0) if (TotalFrameTime > targetframetime )
sparetime = 0; sparetime = 0;
else else
{ {
sparetime = 1000.0f / (float)m_nominalReportedFps; sparetime = TotalFrameTime - m_frameMS * perframe;
sparetime -= m_frameMS * perframe;
if (sparetime < 0) if (sparetime < 0)
sparetime = 0; sparetime = 0;
else if (sparetime > TotalFrameTime) else if (sparetime > TotalFrameTime)
sparetime = TotalFrameTime; sparetime = TotalFrameTime;
} }
for (int i = 0; i < 23; i++) for (int i = 0; i < 23; i++)
{ {
sb[i] = new SimStatsPacket.StatBlock(); sb[i] = new SimStatsPacket.StatBlock();