aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs13
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs18
2 files changed, 13 insertions, 18 deletions
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
1391 int previousFrameTick; 1391 int previousFrameTick;
1392 int maintc; 1392 int maintc;
1393 int sleepMS; 1393 int sleepMS;
1394 int framestart;
1394 1395
1395 while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) 1396 while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
1396 { 1397 {
1397 maintc = Util.EnvironmentTickCount(); 1398 framestart = Util.EnvironmentTickCount();
1398 ++Frame; 1399 ++Frame;
1399 1400
1400// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1401// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
@@ -1481,7 +1482,7 @@ namespace OpenSim.Region.Framework.Scenes
1481 // landMS = Util.EnvironmentTickCountSubtract(ldMS); 1482 // landMS = Util.EnvironmentTickCountSubtract(ldMS);
1482 //} 1483 //}
1483 1484
1484 frameMS = Util.EnvironmentTickCountSubtract(maintc); 1485 // frameMS = Util.EnvironmentTickCountSubtract(maintc);
1485 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1486 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1486 1487
1487 // if (Frame%m_update_avatars == 0) 1488 // if (Frame%m_update_avatars == 0)
@@ -1496,7 +1497,7 @@ namespace OpenSim.Region.Framework.Scenes
1496 1497
1497 // frameMS currently records work frame times, not total frame times (work + any required sleep to 1498 // frameMS currently records work frame times, not total frame times (work + any required sleep to
1498 // reach min frame time. 1499 // reach min frame time.
1499 StatsReporter.addFrameMS(frameMS); 1500 // StatsReporter.addFrameMS(frameMS);
1500 1501
1501 StatsReporter.addAgentMS(agentMS); 1502 StatsReporter.addAgentMS(agentMS);
1502 StatsReporter.addPhysicsMS(physicsMS + physicsMS2); 1503 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
@@ -1553,17 +1554,21 @@ namespace OpenSim.Region.Framework.Scenes
1553 1554
1554 previousFrameTick = m_lastFrameTick; 1555 previousFrameTick = m_lastFrameTick;
1555 m_lastFrameTick = Util.EnvironmentTickCount(); 1556 m_lastFrameTick = Util.EnvironmentTickCount();
1556 maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); 1557 maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart);
1557 maintc = (int)(MinFrameTime * 1000) - maintc; 1558 maintc = (int)(MinFrameTime * 1000) - maintc;
1558 1559
1559 m_firstHeartbeat = false; 1560 m_firstHeartbeat = false;
1560 1561
1562
1561 sleepMS = Util.EnvironmentTickCount(); 1563 sleepMS = Util.EnvironmentTickCount();
1564
1562 if (maintc > 0) 1565 if (maintc > 0)
1563 Thread.Sleep(maintc); 1566 Thread.Sleep(maintc);
1564 1567
1565 sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); 1568 sleepMS = Util.EnvironmentTickCountSubtract(sleepMS);
1569 frameMS = Util.EnvironmentTickCountSubtract(framestart);
1566 StatsReporter.addSleepMS(sleepMS); 1570 StatsReporter.addSleepMS(sleepMS);
1571 StatsReporter.addFrameMS(frameMS);
1567 1572
1568 // Optionally warn if a frame takes double the amount of time that it should. 1573 // Optionally warn if a frame takes double the amount of time that it should.
1569 if (DebugUpdates 1574 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
253 physfps = 0; 253 physfps = 0;
254 254
255#endregion 255#endregion
256
257 //Our time dilation is 0.91 when we're running a full speed,
258 // therefore to make sure we get an appropriate range,
259 // we have to factor in our error. (0.10f * statsUpdateFactor)
260 // multiplies the fix for the error times the amount of times it'll occur a second
261 // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
262 // Then we divide the whole amount by the amount of seconds pass in between stats updates.
263
264 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
265 // values to X-per-second values.
266
267 float factor = 1 / statsUpdateFactor; 256 float factor = 1 / statsUpdateFactor;
268 if (reportedFPS <= 0) 257 if (reportedFPS <= 0)
269 reportedFPS = 1; 258 reportedFPS = 1;
270 259
271 float perframe = 1.0f / (float)reportedFPS; 260 float perframe = 1.0f / (float)reportedFPS;
272 261
273 float TotalFrameTime = 1000.0f * statsUpdateFactor * perframe; 262 float TotalFrameTime = m_frameMS * perframe;
274 263
275 float targetframetime = 1100.0f / (float)m_nominalReportedFps; 264 float targetframetime = 1100.0f / (float)m_nominalReportedFps;
276 265
@@ -279,7 +268,8 @@ namespace OpenSim.Region.Framework.Scenes
279 sparetime = 0; 268 sparetime = 0;
280 else 269 else
281 { 270 {
282 sparetime = TotalFrameTime - m_frameMS * perframe; 271 sparetime = m_frameMS - m_physicsMS - m_agentMS;
272 sparetime *= perframe;
283 if (sparetime < 0) 273 if (sparetime < 0)
284 sparetime = 0; 274 sparetime = 0;
285 else if (sparetime > TotalFrameTime) 275 else if (sparetime > TotalFrameTime)
@@ -290,7 +280,7 @@ namespace OpenSim.Region.Framework.Scenes
290 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; 280 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
291 // m_imageMS m_netMS are not included in m_frameMS 281 // m_imageMS m_netMS are not included in m_frameMS
292 282
293 m_otherMS = m_frameMS - m_physicsMS - m_agentMS; 283 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS;
294 if (m_otherMS < 0) 284 if (m_otherMS < 0)
295 m_otherMS = 0; 285 m_otherMS = 0;
296 286