aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/Scene.cs59
1 files changed, 33 insertions, 26 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 1952402..4e629da 100755
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -361,9 +361,9 @@ namespace OpenSim.Region.Framework.Scenes
361 /// </remarks> 361 /// </remarks>
362 public float FrameTime { get; private set; } 362 public float FrameTime { get; private set; }
363 363
364 // statistics frame scale factor for viewer and scripts. 364 // Normalize the frame related stats to nominal 55fps for viewer and scripts option
365 // see SimStatsReporter.cs 365 // see SimStatsReporter.cs
366 public float StatisticsFPSfactor { get; private set; } 366 public bool Normalized55FPS { get; private set; }
367 367
368 /// <summary> 368 /// <summary>
369 /// The minimum length of time in seconds that will be taken for a scene frame. 369 /// The minimum length of time in seconds that will be taken for a scene frame.
@@ -860,7 +860,7 @@ namespace OpenSim.Region.Framework.Scenes
860 { 860 {
861 m_config = config; 861 m_config = config;
862 FrameTime = 0.0908f; 862 FrameTime = 0.0908f;
863 StatisticsFPSfactor = 5.0f; 863 Normalized55FPS = true;
864 MinMaintenanceTime = 1; 864 MinMaintenanceTime = 1;
865 SeeIntoRegion = true; 865 SeeIntoRegion = true;
866 866
@@ -1101,7 +1101,7 @@ namespace OpenSim.Region.Framework.Scenes
1101 } 1101 }
1102 1102
1103 FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime); 1103 FrameTime = startupConfig.GetFloat( "FrameTime", FrameTime);
1104 StatisticsFPSfactor = startupConfig.GetFloat( "StatisticsFPSfactor", StatisticsFPSfactor); 1104 Normalized55FPS = startupConfig.GetBoolean( "Normalized55FPS", Normalized55FPS);
1105 1105
1106 m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup); 1106 m_update_backup = startupConfig.GetInt("UpdateStorageEveryNFrames", m_update_backup);
1107 m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations); 1107 m_update_coarse_locations = startupConfig.GetInt("UpdateCoarseLocationsEveryNFrames", m_update_coarse_locations);
@@ -1669,6 +1669,7 @@ namespace OpenSim.Region.Framework.Scenes
1669 endFrame = Frame + frames; 1669 endFrame = Frame + frames;
1670 1670
1671 float physicsFPS = 0f; 1671 float physicsFPS = 0f;
1672 float frameTimeMS = FrameTime * 1000.0f;
1672 1673
1673 int previousFrameTick; 1674 int previousFrameTick;
1674 1675
@@ -1676,6 +1677,7 @@ namespace OpenSim.Region.Framework.Scenes
1676 double tmpMS2; 1677 double tmpMS2;
1677 double framestart; 1678 double framestart;
1678 float sleepMS; 1679 float sleepMS;
1680 float sleepError = 0;
1679 1681
1680 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) 1682 while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame))
1681 { 1683 {
@@ -1759,8 +1761,7 @@ namespace OpenSim.Region.Framework.Scenes
1759 1761
1760 // Delete temp-on-rez stuff 1762 // Delete temp-on-rez stuff
1761 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1763 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
1762 { 1764 {
1763
1764 m_cleaningTemps = true; 1765 m_cleaningTemps = true;
1765 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); 1766 Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; });
1766 tmpMS2 = Util.GetTimeStampMS(); 1767 tmpMS2 = Util.GetTimeStampMS();
@@ -1840,21 +1841,11 @@ namespace OpenSim.Region.Framework.Scenes
1840 } 1841 }
1841 1842
1842 EventManager.TriggerRegionHeartbeatEnd(this); 1843 EventManager.TriggerRegionHeartbeatEnd(this);
1843 1844 m_firstHeartbeat = false;
1844 Watchdog.UpdateThread(); 1845 Watchdog.UpdateThread();
1845 1846
1846 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1847 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1847 1848
1848 StatsReporter.AddPhysicsFPS(physicsFPS);
1849 StatsReporter.AddTimeDilation(TimeDilation);
1850 StatsReporter.AddFPS(1);
1851
1852 StatsReporter.addAgentMS(agentMS);
1853 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1854 StatsReporter.addOtherMS(otherMS);
1855 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1856
1857
1858 tmpMS = Util.GetTimeStampMS(); 1849 tmpMS = Util.GetTimeStampMS();
1859 1850
1860 previousFrameTick = m_lastFrameTick; 1851 previousFrameTick = m_lastFrameTick;
@@ -1862,20 +1853,36 @@ namespace OpenSim.Region.Framework.Scenes
1862 1853
1863 // estimate sleep time 1854 // estimate sleep time
1864 tmpMS2 = tmpMS - framestart; 1855 tmpMS2 = tmpMS - framestart;
1865 tmpMS2 = (double)FrameTime * 1000.0D - tmpMS2; 1856 tmpMS2 = (double)frameTimeMS - tmpMS2 - sleepError;
1866
1867 m_firstHeartbeat = false;
1868 1857
1858 // reuse frameMS as temporary
1859 frameMS = (float)tmpMS2;
1860
1869 // sleep if we can 1861 // sleep if we can
1870 if (tmpMS2 > 0) 1862 if (tmpMS2 > 0)
1871 Thread.Sleep((int)(tmpMS2 +0.5)); 1863 {
1864 Thread.Sleep((int)(tmpMS2 + 0.5));
1872 1865
1873 tmpMS2 = Util.GetTimeStampMS(); 1866 tmpMS2 = Util.GetTimeStampMS();
1867 sleepMS = (float)(tmpMS2 - tmpMS);
1868 sleepError = sleepMS - frameMS;
1869 Util.Clamp(sleepError, 0.0f, 20f);
1870 frameMS = (float)(tmpMS2 - framestart);
1871 }
1872 else
1873 {
1874 tmpMS2 = Util.GetTimeStampMS();
1875 frameMS = (float)(tmpMS2 - framestart);
1876 sleepMS = 0.0f;
1877 sleepError = 0.0f;
1878 }
1874 1879
1875 sleepMS = (float)(tmpMS2 - tmpMS); 1880 // script time is not scene frame time, but is displayed per frame
1876 frameMS = (float)(tmpMS2 - framestart); 1881 float scriptTimeMS = GetAndResetScriptExecutionTime();
1877 StatsReporter.addSleepMS(sleepMS); 1882 StatsReporter.AddFrameStats(TimeDilation, physicsFPS, agentMS,
1878 StatsReporter.addFrameMS(frameMS); 1883 physicsMS + physicsMS2, otherMS , sleepMS, frameMS, scriptTimeMS);
1884
1885
1879 1886
1880 // if (Frame%m_update_avatars == 0) 1887 // if (Frame%m_update_avatars == 0)
1881 // UpdateInWorldTime(); 1888 // UpdateInWorldTime();