aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs94
1 files changed, 43 insertions, 51 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index b79892d..315b340 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -222,6 +222,7 @@ namespace OpenSim.Region.Framework.Scenes
222 private int backupMS; 222 private int backupMS;
223 private int terrainMS; 223 private int terrainMS;
224 private int landMS; 224 private int landMS;
225 private int spareMS;
225 226
226 /// <summary> 227 /// <summary>
227 /// Tick at which the last frame was processed. 228 /// Tick at which the last frame was processed.
@@ -1408,45 +1409,41 @@ namespace OpenSim.Region.Framework.Scenes
1408 endFrame = Frame + frames; 1409 endFrame = Frame + frames;
1409 1410
1410 float physicsFPS = 0f; 1411 float physicsFPS = 0f;
1411 int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; 1412 int previousFrameTick, tmpMS;
1412 int previousFrameTick; 1413 int maintc = Util.EnvironmentTickCount();
1413 int maintc;
1414 int sleepMS;
1415 int framestart;
1416 1414
1417 while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) 1415 while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
1418 { 1416 {
1419 framestart = Util.EnvironmentTickCount();
1420 ++Frame; 1417 ++Frame;
1421 1418
1422// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1419// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1423 1420
1424 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; 1421 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0;
1425 1422
1426 try 1423 try
1427 { 1424 {
1428 // Apply taints in terrain module to terrain in physics scene 1425 // Apply taints in terrain module to terrain in physics scene
1429 if (Frame % m_update_terrain == 0) 1426 if (Frame % m_update_terrain == 0)
1430 { 1427 {
1431 terMS = Util.EnvironmentTickCount(); 1428 tmpMS = Util.EnvironmentTickCount();
1432 UpdateTerrain(); 1429 UpdateTerrain();
1433 terrainMS = Util.EnvironmentTickCountSubtract(terMS); 1430 terrainMS = Util.EnvironmentTickCountSubtract(tmpMS);
1434 } 1431 }
1435 1432
1436 tmpPhysicsMS2 = Util.EnvironmentTickCount(); 1433 tmpMS = Util.EnvironmentTickCount();
1437 if ((Frame % m_update_physics == 0) && m_physics_enabled) 1434 if ((Frame % m_update_physics == 0) && m_physics_enabled)
1438 m_sceneGraph.UpdatePreparePhysics(); 1435 m_sceneGraph.UpdatePreparePhysics();
1439 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpPhysicsMS2); 1436 physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS);
1440 1437
1441 // Apply any pending avatar force input to the avatar's velocity 1438 // Apply any pending avatar force input to the avatar's velocity
1442 tmpAgentMS = Util.EnvironmentTickCount(); 1439 tmpMS = Util.EnvironmentTickCount();
1443 if (Frame % m_update_entitymovement == 0) 1440 if (Frame % m_update_entitymovement == 0)
1444 m_sceneGraph.UpdateScenePresenceMovement(); 1441 m_sceneGraph.UpdateScenePresenceMovement();
1445 agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); 1442 agentMS = Util.EnvironmentTickCountSubtract(tmpMS);
1446 1443
1447 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their 1444 // Perform the main physics update. This will do the actual work of moving objects and avatars according to their
1448 // velocity 1445 // velocity
1449 tmpPhysicsMS = Util.EnvironmentTickCount(); 1446 tmpMS = Util.EnvironmentTickCount();
1450 if (Frame % m_update_physics == 0) 1447 if (Frame % m_update_physics == 0)
1451 { 1448 {
1452 if (m_physics_enabled) 1449 if (m_physics_enabled)
@@ -1455,9 +1452,9 @@ namespace OpenSim.Region.Framework.Scenes
1455 if (SynchronizeScene != null) 1452 if (SynchronizeScene != null)
1456 SynchronizeScene(this); 1453 SynchronizeScene(this);
1457 } 1454 }
1458 physicsMS = Util.EnvironmentTickCountSubtract(tmpPhysicsMS); 1455 physicsMS = Util.EnvironmentTickCountSubtract(tmpMS);
1459 1456
1460 tmpAgentMS = Util.EnvironmentTickCount(); 1457 tmpMS = Util.EnvironmentTickCount();
1461 1458
1462 // Check if any objects have reached their targets 1459 // Check if any objects have reached their targets
1463 CheckAtTargets(); 1460 CheckAtTargets();
@@ -1472,29 +1469,29 @@ namespace OpenSim.Region.Framework.Scenes
1472 if (Frame % m_update_presences == 0) 1469 if (Frame % m_update_presences == 0)
1473 m_sceneGraph.UpdatePresences(); 1470 m_sceneGraph.UpdatePresences();
1474 1471
1475 agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); 1472 agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
1476 1473
1477 // Delete temp-on-rez stuff 1474 // Delete temp-on-rez stuff
1478 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1475 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
1479 { 1476 {
1480 tmpTempOnRezMS = Util.EnvironmentTickCount(); 1477 tmpMS = Util.EnvironmentTickCount();
1481 m_cleaningTemps = true; 1478 m_cleaningTemps = true;
1482 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); 1479 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
1483 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpTempOnRezMS); 1480 tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS);
1484 } 1481 }
1485 1482
1486 if (Frame % m_update_events == 0) 1483 if (Frame % m_update_events == 0)
1487 { 1484 {
1488 evMS = Util.EnvironmentTickCount(); 1485 tmpMS = Util.EnvironmentTickCount();
1489 UpdateEvents(); 1486 UpdateEvents();
1490 eventMS = Util.EnvironmentTickCountSubtract(evMS); 1487 eventMS = Util.EnvironmentTickCountSubtract(tmpMS);
1491 } 1488 }
1492 1489
1493 if (Frame % m_update_backup == 0) 1490 if (Frame % m_update_backup == 0)
1494 { 1491 {
1495 backMS = Util.EnvironmentTickCount(); 1492 tmpMS = Util.EnvironmentTickCount();
1496 UpdateStorageBackup(); 1493 UpdateStorageBackup();
1497 backupMS = Util.EnvironmentTickCountSubtract(backMS); 1494 backupMS = Util.EnvironmentTickCountSubtract(tmpMS);
1498 } 1495 }
1499 1496
1500 //if (Frame % m_update_land == 0) 1497 //if (Frame % m_update_land == 0)
@@ -1503,24 +1500,6 @@ namespace OpenSim.Region.Framework.Scenes
1503 // UpdateLand(); 1500 // UpdateLand();
1504 // landMS = Util.EnvironmentTickCountSubtract(ldMS); 1501 // landMS = Util.EnvironmentTickCountSubtract(ldMS);
1505 //} 1502 //}
1506
1507 // frameMS = Util.EnvironmentTickCountSubtract(maintc);
1508 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1509
1510 // if (Frame%m_update_avatars == 0)
1511 // UpdateInWorldTime();
1512 StatsReporter.AddPhysicsFPS(physicsFPS);
1513 StatsReporter.AddTimeDilation(TimeDilation);
1514 StatsReporter.AddFPS(1);
1515
1516 // frameMS currently records work frame times, not total frame times (work + any required sleep to
1517 // reach min frame time.
1518 // StatsReporter.addFrameMS(frameMS);
1519
1520 StatsReporter.addAgentMS(agentMS);
1521 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1522 StatsReporter.addOtherMS(otherMS);
1523 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1524 1503
1525 if (LoginsDisabled && Frame == 20) 1504 if (LoginsDisabled && Frame == 20)
1526 { 1505 {
@@ -1571,23 +1550,36 @@ namespace OpenSim.Region.Framework.Scenes
1571 1550
1572 previousFrameTick = m_lastFrameTick; 1551 previousFrameTick = m_lastFrameTick;
1573 m_lastFrameTick = Util.EnvironmentTickCount(); 1552 m_lastFrameTick = Util.EnvironmentTickCount();
1574 maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); 1553 tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc);
1575 maintc = (int)(MinFrameTime * 1000) - maintc; 1554 tmpMS = (int)(MinFrameTime * 1000) - tmpMS;
1576 1555
1577 m_firstHeartbeat = false; 1556 m_firstHeartbeat = false;
1578 1557
1558 if (tmpMS > 0)
1559 {
1560 Thread.Sleep(tmpMS);
1561 spareMS += tmpMS;
1562 }
1563
1564 frameMS = Util.EnvironmentTickCountSubtract(maintc);
1565 maintc = Util.EnvironmentTickCount();
1579 1566
1580 sleepMS = Util.EnvironmentTickCount(); 1567 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1581 1568
1582 if (maintc > 0) 1569 // if (Frame%m_update_avatars == 0)
1583 Thread.Sleep(maintc); 1570 // UpdateInWorldTime();
1571 StatsReporter.AddPhysicsFPS(physicsFPS);
1572 StatsReporter.AddTimeDilation(TimeDilation);
1573 StatsReporter.AddFPS(1);
1584 1574
1585 sleepMS = Util.EnvironmentTickCountSubtract(sleepMS);
1586 frameMS = Util.EnvironmentTickCountSubtract(framestart);
1587 StatsReporter.addSleepMS(sleepMS);
1588 StatsReporter.addFrameMS(frameMS); 1575 StatsReporter.addFrameMS(frameMS);
1589 1576 StatsReporter.addAgentMS(agentMS);
1590 // Optionally warn if a frame takes double the amount of time that it should. 1577 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1578 StatsReporter.addOtherMS(otherMS);
1579 StatsReporter.AddSpareMS(spareMS);
1580 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1581
1582 // Optionally warn if a frame takes double the amount of time that it should.
1591 if (DebugUpdates 1583 if (DebugUpdates
1592 && Util.EnvironmentTickCountSubtract( 1584 && Util.EnvironmentTickCountSubtract(
1593 m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) 1585 m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2))