aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs78
1 files changed, 1 insertions, 77 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 0905a56..e1e06d0 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -346,11 +346,6 @@ namespace OpenSim.Region.Framework.Scenes
346 } 346 }
347 347
348 /// <summary> 348 /// <summary>
349 /// Current maintenance run number
350 /// </summary>
351 public uint MaintenanceRun { get; private set; }
352
353 /// <summary>
354 /// Frame time 349 /// Frame time
355 /// </remarks> 350 /// </remarks>
356 public float FrameTime { get; private set; } 351 public float FrameTime { get; private set; }
@@ -361,14 +356,6 @@ namespace OpenSim.Region.Framework.Scenes
361 // see SimStatsReporter.cs 356 // see SimStatsReporter.cs
362 public bool Normalized55FPS { get; private set; } 357 public bool Normalized55FPS { get; private set; }
363 358
364 /// <summary>
365 /// The minimum length of time in seconds that will be taken for a scene frame.
366 /// </summary>
367 /// <remarks>
368 /// Always derived from MinFrameTicks.
369 /// </remarks>
370 public float MinMaintenanceTime { get; private set; }
371
372 private int m_update_physics = 1; 359 private int m_update_physics = 1;
373 private int m_update_entitymovement = 1; 360 private int m_update_entitymovement = 1;
374 private int m_update_objects = 1; 361 private int m_update_objects = 1;
@@ -377,7 +364,6 @@ namespace OpenSim.Region.Framework.Scenes
377 private int m_update_backup = 200; 364 private int m_update_backup = 200;
378 365
379 private int m_update_terrain = 1000; 366 private int m_update_terrain = 1000;
380 private int m_update_land = 10;
381 367
382 private int m_update_coarse_locations = 5; 368 private int m_update_coarse_locations = 5;
383 private int m_update_temp_cleaning = 180; 369 private int m_update_temp_cleaning = 180;
@@ -399,11 +385,6 @@ namespace OpenSim.Region.Framework.Scenes
399 private int m_lastFrameTick; 385 private int m_lastFrameTick;
400 386
401 /// <summary> 387 /// <summary>
402 /// Tick at which the last maintenance run occurred.
403 /// </summary>
404 private int m_lastMaintenanceTick;
405
406 /// <summary>
407 /// Total script execution time (in Stopwatch Ticks) since the last frame 388 /// Total script execution time (in Stopwatch Ticks) since the last frame
408 /// </summary> 389 /// </summary>
409 private long m_scriptExecutionTime = 0; 390 private long m_scriptExecutionTime = 0;
@@ -419,11 +400,6 @@ namespace OpenSim.Region.Framework.Scenes
419 /// </summary> 400 /// </summary>
420 private ManualResetEvent m_updateWaitEvent = new ManualResetEvent(false); 401 private ManualResetEvent m_updateWaitEvent = new ManualResetEvent(false);
421 402
422 /// <summary>
423 /// Used to control maintenance thread runs.
424 /// </summary>
425 private ManualResetEvent m_maintenanceWaitEvent = new ManualResetEvent(false);
426
427 // TODO: Possibly stop other classes being able to manipulate this directly. 403 // TODO: Possibly stop other classes being able to manipulate this directly.
428 private SceneGraph m_sceneGraph; 404 private SceneGraph m_sceneGraph;
429 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing 405 private readonly Timer m_restartTimer = new Timer(15000); // Wait before firing
@@ -467,7 +443,7 @@ namespace OpenSim.Region.Framework.Scenes
467 /// Is the scene active? 443 /// Is the scene active?
468 /// </summary> 444 /// </summary>
469 /// <remarks> 445 /// <remarks>
470 /// If false, maintenance and update loops are not being run, though after setting to false update may still 446 /// If false, update loop is not being run, though after setting to false update may still
471 /// be active for a period (and IsRunning will still be true). Updates can still be triggered manually if 447 /// be active for a period (and IsRunning will still be true). Updates can still be triggered manually if
472 /// the scene is not active. 448 /// the scene is not active.
473 /// </remarks> 449 /// </remarks>
@@ -497,7 +473,6 @@ namespace OpenSim.Region.Framework.Scenes
497 public bool IsRunning { get { return m_isRunning; } } 473 public bool IsRunning { get { return m_isRunning; } }
498 private volatile bool m_isRunning; 474 private volatile bool m_isRunning;
499 475
500// private int m_lastUpdate;
501 private bool m_firstHeartbeat = true; 476 private bool m_firstHeartbeat = true;
502 477
503// private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time; 478// private UpdatePrioritizationSchemes m_priorityScheme = UpdatePrioritizationSchemes.Time;
@@ -853,7 +828,6 @@ namespace OpenSim.Region.Framework.Scenes
853 FrameTimeWarnPercent = 60; 828 FrameTimeWarnPercent = 60;
854 FrameTimeCritPercent = 40; 829 FrameTimeCritPercent = 40;
855 Normalized55FPS = true; 830 Normalized55FPS = true;
856 MinMaintenanceTime = 1;
857 SeeIntoRegion = true; 831 SeeIntoRegion = true;
858 832
859 Random random = new Random(); 833 Random random = new Random();
@@ -1614,62 +1588,12 @@ namespace OpenSim.Region.Framework.Scenes
1614 // alarms for scenes with many objects. 1588 // alarms for scenes with many objects.
1615 Update(1); 1589 Update(1);
1616 1590
1617 WorkManager.StartThread(
1618 Maintenance, string.Format("Maintenance ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, true);
1619
1620 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true; 1591 Watchdog.GetCurrentThreadInfo().AlarmIfTimeout = true;
1621 m_lastFrameTick = Util.EnvironmentTickCount(); 1592 m_lastFrameTick = Util.EnvironmentTickCount();
1622 Update(-1); 1593 Update(-1);
1623
1624 Watchdog.RemoveThread();
1625 }
1626
1627 private void Maintenance()
1628 {
1629 DoMaintenance(-1);
1630
1631 Watchdog.RemoveThread(); 1594 Watchdog.RemoveThread();
1632 } 1595 }
1633 1596
1634 public void DoMaintenance(int runs)
1635 {
1636 long? endRun = null;
1637 int runtc, tmpMS;
1638 int previousMaintenanceTick;
1639
1640 if (runs >= 0)
1641 endRun = MaintenanceRun + runs;
1642
1643
1644 while (!m_shuttingDown && ((endRun == null && Active) || MaintenanceRun < endRun))
1645 {
1646 runtc = Util.EnvironmentTickCount();
1647 ++MaintenanceRun;
1648
1649 // m_log.DebugFormat("[SCENE]: Maintenance run {0} in {1}", MaintenanceRun, Name);
1650
1651 Watchdog.UpdateThread();
1652
1653 previousMaintenanceTick = m_lastMaintenanceTick;
1654 m_lastMaintenanceTick = Util.EnvironmentTickCount();
1655 runtc = Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, runtc);
1656 runtc = (int)(MinMaintenanceTime * 1000) - runtc;
1657
1658 if (runtc > 0)
1659 m_maintenanceWaitEvent.WaitOne(runtc);
1660
1661 // Optionally warn if a frame takes double the amount of time that it should.
1662 if (DebugUpdates
1663 && Util.EnvironmentTickCountSubtract(
1664 m_lastMaintenanceTick, previousMaintenanceTick) > (int)(MinMaintenanceTime * 1000 * 2))
1665 m_log.WarnFormat(
1666 "[SCENE]: Maintenance took {0} ms (desired max {1} ms) in {2}",
1667 Util.EnvironmentTickCountSubtract(m_lastMaintenanceTick, previousMaintenanceTick),
1668 MinMaintenanceTime * 1000,
1669 RegionInfo.RegionName);
1670 }
1671 }
1672
1673 public override void Update(int frames) 1597 public override void Update(int frames)
1674 { 1598 {
1675 long? endFrame = null; 1599 long? endFrame = null;