diff options
author | UbitUmarov | 2015-09-04 12:05:31 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-04 12:05:31 +0100 |
commit | 08f9c54554cec756c2bffad69d2303e227667c17 (patch) | |
tree | 116703f72850e3e2d40b064a5f50f4a39eb41bd5 | |
parent | add a GetTimeStampMS method, this returns a time stamp in miliSeconds with th... (diff) | |
download | opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.zip opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.tar.gz opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.tar.bz2 opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.tar.xz |
use GetTimeStampMS to increase heartbeat and stats timing resolution. some rearrange on stat code ( MOSES special ones still out )
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 123 | ||||
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 105 |
2 files changed, 122 insertions, 106 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index c1da7fa..c5c2147 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -398,16 +398,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
398 | private int m_update_coarse_locations = 50; | 398 | private int m_update_coarse_locations = 50; |
399 | private int m_update_temp_cleaning = 180; | 399 | private int m_update_temp_cleaning = 180; |
400 | 400 | ||
401 | private int agentMS; | 401 | private float agentMS; |
402 | private int frameMS; | 402 | private float frameMS; |
403 | private int physicsMS2; | 403 | private float physicsMS2; |
404 | private int physicsMS; | 404 | private float physicsMS; |
405 | private int otherMS; | 405 | private float otherMS; |
406 | private int tempOnRezMS; | 406 | private float tempOnRezMS; |
407 | private int eventMS; | 407 | private float eventMS; |
408 | private int backupMS; | 408 | private float backupMS; |
409 | private int terrainMS; | 409 | private float terrainMS; |
410 | private int landMS; | 410 | private float landMS; |
411 | 411 | ||
412 | // A temporary configuration flag to enable using FireAndForget to process | 412 | // A temporary configuration flag to enable using FireAndForget to process |
413 | // collisions from the physics engine. There is a problem with collisions | 413 | // collisions from the physics engine. There is a problem with collisions |
@@ -785,15 +785,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
785 | get { return m_capsModule; } | 785 | get { return m_capsModule; } |
786 | } | 786 | } |
787 | 787 | ||
788 | public int MonitorFrameTime { get { return frameMS; } } | 788 | public int MonitorFrameTime { get { return (int)frameMS; } } |
789 | public int MonitorPhysicsUpdateTime { get { return physicsMS; } } | 789 | public int MonitorPhysicsUpdateTime { get { return (int)physicsMS; } } |
790 | public int MonitorPhysicsSyncTime { get { return physicsMS2; } } | 790 | public int MonitorPhysicsSyncTime { get { return (int)physicsMS2; } } |
791 | public int MonitorOtherTime { get { return otherMS; } } | 791 | public int MonitorOtherTime { get { return (int)otherMS; } } |
792 | public int MonitorTempOnRezTime { get { return tempOnRezMS; } } | 792 | public int MonitorTempOnRezTime { get { return (int)tempOnRezMS; } } |
793 | public int MonitorEventTime { get { return eventMS; } } // This may need to be divided into each event? | 793 | public int MonitorEventTime { get { return (int)eventMS; } } // This may need to be divided into each event? |
794 | public int MonitorBackupTime { get { return backupMS; } } | 794 | public int MonitorBackupTime { get { return (int)backupMS; } } |
795 | public int MonitorTerrainTime { get { return terrainMS; } } | 795 | public int MonitorTerrainTime { get { return (int)terrainMS; } } |
796 | public int MonitorLandTime { get { return landMS; } } | 796 | public int MonitorLandTime { get { return (int)landMS; } } |
797 | public int MonitorLastFrameTick { get { return m_lastFrameTick; } } | 797 | public int MonitorLastFrameTick { get { return m_lastFrameTick; } } |
798 | 798 | ||
799 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get; set; } | 799 | public UpdatePrioritizationSchemes UpdatePrioritizationScheme { get; set; } |
@@ -1714,20 +1714,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1714 | 1714 | ||
1715 | float physicsFPS = 0f; | 1715 | float physicsFPS = 0f; |
1716 | 1716 | ||
1717 | int tmpMS; | ||
1718 | int previousFrameTick; | 1717 | int previousFrameTick; |
1719 | int maintc; | 1718 | |
1720 | int sleepMS; | 1719 | double tmpMS; |
1721 | int framestart; | 1720 | double tmpMS2; |
1721 | double framestart; | ||
1722 | float sleepMS; | ||
1722 | 1723 | ||
1723 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1724 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1724 | { | 1725 | { |
1725 | framestart = Util.EnvironmentTickCount(); | 1726 | framestart = Util.GetTimeStampMS(); |
1726 | ++Frame; | 1727 | ++Frame; |
1727 | 1728 | ||
1728 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); | 1729 | // m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); |
1729 | 1730 | ||
1730 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1731 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0f; |
1731 | 1732 | ||
1732 | try | 1733 | try |
1733 | { | 1734 | { |
@@ -1735,7 +1736,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1735 | 1736 | ||
1736 | // Apply taints in terrain module to terrain in physics scene | 1737 | // Apply taints in terrain module to terrain in physics scene |
1737 | 1738 | ||
1738 | tmpMS = Util.EnvironmentTickCount(); | 1739 | tmpMS = Util.GetTimeStampMS(); |
1740 | |||
1739 | if (Frame % 4 == 0) | 1741 | if (Frame % 4 == 0) |
1740 | { | 1742 | { |
1741 | CheckTerrainUpdates(); | 1743 | CheckTerrainUpdates(); |
@@ -1746,26 +1748,29 @@ namespace OpenSim.Region.Framework.Scenes | |||
1746 | UpdateTerrain(); | 1748 | UpdateTerrain(); |
1747 | } | 1749 | } |
1748 | 1750 | ||
1749 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1751 | tmpMS2 = Util.GetTimeStampMS(); |
1750 | tmpMS = Util.EnvironmentTickCount(); | 1752 | terrainMS = (float)(tmpMS2 - tmpMS); |
1753 | tmpMS = tmpMS2; | ||
1751 | 1754 | ||
1752 | if (PhysicsEnabled && Frame % m_update_physics == 0) | 1755 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1753 | m_sceneGraph.UpdatePreparePhysics(); | 1756 | m_sceneGraph.UpdatePreparePhysics(); |
1754 | 1757 | ||
1755 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1758 | tmpMS2 = Util.GetTimeStampMS(); |
1759 | physicsMS2 = (float)(tmpMS2 - tmpMS); | ||
1760 | tmpMS = tmpMS2; | ||
1756 | 1761 | ||
1757 | // Apply any pending avatar force input to the avatar's velocity | 1762 | // Apply any pending avatar force input to the avatar's velocity |
1758 | tmpMS = Util.EnvironmentTickCount(); | ||
1759 | if (Frame % m_update_entitymovement == 0) | 1763 | if (Frame % m_update_entitymovement == 0) |
1760 | m_sceneGraph.UpdateScenePresenceMovement(); | 1764 | m_sceneGraph.UpdateScenePresenceMovement(); |
1761 | 1765 | ||
1762 | // Get the simulation frame time that the avatar force input | 1766 | // Get the simulation frame time that the avatar force input |
1763 | // took | 1767 | // took |
1764 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1768 | tmpMS2 = Util.GetTimeStampMS(); |
1769 | agentMS = (float)(tmpMS2 - tmpMS); | ||
1770 | tmpMS = tmpMS2; | ||
1765 | 1771 | ||
1766 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1772 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1767 | // velocity | 1773 | // velocity |
1768 | tmpMS = Util.EnvironmentTickCount(); | ||
1769 | if (Frame % m_update_physics == 0) | 1774 | if (Frame % m_update_physics == 0) |
1770 | { | 1775 | { |
1771 | if (PhysicsEnabled) | 1776 | if (PhysicsEnabled) |
@@ -1774,12 +1779,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
1774 | if (SynchronizeScene != null) | 1779 | if (SynchronizeScene != null) |
1775 | SynchronizeScene(this); | 1780 | SynchronizeScene(this); |
1776 | } | 1781 | } |
1777 | 1782 | ||
1778 | // Add the main physics update time to the prepare physics time | 1783 | tmpMS2 = Util.GetTimeStampMS(); |
1779 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1784 | physicsMS = (float)(tmpMS2 - tmpMS); |
1780 | 1785 | tmpMS = tmpMS2; | |
1781 | // Start the stopwatch for the remainder of the simulation | ||
1782 | tmpMS = Util.EnvironmentTickCount(); | ||
1783 | 1786 | ||
1784 | // Check if any objects have reached their targets | 1787 | // Check if any objects have reached their targets |
1785 | CheckAtTargets(); | 1788 | CheckAtTargets(); |
@@ -1794,29 +1797,37 @@ namespace OpenSim.Region.Framework.Scenes | |||
1794 | if (Frame % m_update_presences == 0) | 1797 | if (Frame % m_update_presences == 0) |
1795 | m_sceneGraph.UpdatePresences(); | 1798 | m_sceneGraph.UpdatePresences(); |
1796 | 1799 | ||
1797 | agentMS += Util.EnvironmentTickCountSubtract(tmpMS); | 1800 | tmpMS2 = Util.GetTimeStampMS(); |
1801 | agentMS += (float)(tmpMS2 - tmpMS); | ||
1802 | tmpMS = tmpMS2; | ||
1798 | 1803 | ||
1799 | // Delete temp-on-rez stuff | 1804 | // Delete temp-on-rez stuff |
1800 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) | 1805 | if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) |
1801 | { | 1806 | { |
1802 | tmpMS = Util.EnvironmentTickCount(); | 1807 | |
1803 | m_cleaningTemps = true; | 1808 | m_cleaningTemps = true; |
1804 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); | 1809 | Util.FireAndForget(delegate { CleanTempObjects(); m_cleaningTemps = false; }); |
1805 | tempOnRezMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1810 | tmpMS2 = Util.GetTimeStampMS(); |
1811 | tempOnRezMS = (float)(tmpMS2 - tmpMS); // bad.. counts the FireAndForget, not CleanTempObjects | ||
1812 | tmpMS = tmpMS2; | ||
1806 | } | 1813 | } |
1807 | 1814 | ||
1808 | if (Frame % m_update_events == 0) | 1815 | if (Frame % m_update_events == 0) |
1809 | { | 1816 | { |
1810 | tmpMS = Util.EnvironmentTickCount(); | ||
1811 | UpdateEvents(); | 1817 | UpdateEvents(); |
1812 | eventMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1818 | |
1819 | tmpMS2 = Util.GetTimeStampMS(); | ||
1820 | eventMS = (float)(tmpMS2 - tmpMS); | ||
1821 | tmpMS = tmpMS2; | ||
1813 | } | 1822 | } |
1814 | 1823 | ||
1815 | if (PeriodicBackup && Frame % m_update_backup == 0) | 1824 | if (PeriodicBackup && Frame % m_update_backup == 0) |
1816 | { | 1825 | { |
1817 | tmpMS = Util.EnvironmentTickCount(); | ||
1818 | UpdateStorageBackup(); | 1826 | UpdateStorageBackup(); |
1819 | backupMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1827 | |
1828 | tmpMS2 = Util.GetTimeStampMS(); | ||
1829 | backupMS = (float)(tmpMS2 - tmpMS); | ||
1830 | tmpMS = tmpMS2; | ||
1820 | } | 1831 | } |
1821 | 1832 | ||
1822 | //if (Frame % m_update_land == 0) | 1833 | //if (Frame % m_update_land == 0) |
@@ -1887,20 +1898,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1887 | StatsReporter.addOtherMS(otherMS); | 1898 | StatsReporter.addOtherMS(otherMS); |
1888 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | 1899 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); |
1889 | 1900 | ||
1901 | |||
1902 | tmpMS = Util.GetTimeStampMS(); | ||
1903 | |||
1890 | previousFrameTick = m_lastFrameTick; | 1904 | previousFrameTick = m_lastFrameTick; |
1891 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1905 | m_lastFrameTick = (int)(tmpMS + 0.5); |
1892 | tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart); | 1906 | |
1893 | tmpMS = (int)(MinFrameTime * 1000) - tmpMS; | 1907 | // estimate sleep time |
1908 | tmpMS2 = tmpMS - framestart; | ||
1909 | tmpMS2 = (double)MinFrameTime * 1000.0D - tmpMS2; | ||
1894 | 1910 | ||
1895 | m_firstHeartbeat = false; | 1911 | m_firstHeartbeat = false; |
1896 | 1912 | ||
1897 | sleepMS = Util.EnvironmentTickCount(); | 1913 | // sleep if we can |
1914 | if (tmpMS2 > 0) | ||
1915 | Thread.Sleep((int)(tmpMS2 +0.5)); | ||
1898 | 1916 | ||
1899 | if (tmpMS > 0) | 1917 | tmpMS2 = Util.GetTimeStampMS(); |
1900 | Thread.Sleep(tmpMS); | ||
1901 | 1918 | ||
1902 | sleepMS = Util.EnvironmentTickCountSubtract(sleepMS); | 1919 | sleepMS = (float)(tmpMS2 - tmpMS); |
1903 | frameMS = Util.EnvironmentTickCountSubtract(framestart); | 1920 | frameMS = (float)(tmpMS2 - framestart); |
1904 | StatsReporter.addSleepMS(sleepMS); | 1921 | StatsReporter.addSleepMS(sleepMS); |
1905 | StatsReporter.addFrameMS(frameMS); | 1922 | StatsReporter.addFrameMS(frameMS); |
1906 | 1923 | ||
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index e0030ec..9f7c769 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | Agents = 13, | 90 | Agents = 13, |
91 | ChildAgents = 14, | 91 | ChildAgents = 14, |
92 | ActiveScripts = 15, | 92 | ActiveScripts = 15, |
93 | ScriptLinesPerSecond = 16, | 93 | LSLScriptLinesPerSecond = 16, // viewers don't like this |
94 | InPacketsPerSecond = 17, | 94 | InPacketsPerSecond = 17, |
95 | OutPacketsPerSecond = 18, | 95 | OutPacketsPerSecond = 18, |
96 | PendingDownloads = 19, | 96 | PendingDownloads = 19, |
@@ -109,11 +109,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
109 | SimSpareMs = 32, | 109 | SimSpareMs = 32, |
110 | SimSleepMs = 33, | 110 | SimSleepMs = 33, |
111 | SimIoPumpTime = 34, | 111 | SimIoPumpTime = 34, |
112 | FrameDilation = 35, | 112 | SimPCTSscriptsRun = 35, |
113 | UsersLoggingIn = 36, | 113 | SimRegionIdle = 36, // dataserver only |
114 | TotalGeoPrim = 37, | 114 | SimRegionIdlePossible = 37, // dataserver only |
115 | TotalMesh = 38, | 115 | SimAIStepTimeMS = 38, |
116 | ThreadCount = 39 | 116 | SimSkippedSillouet_PS = 39, |
117 | SimSkippedCharsPerC = 40, | ||
118 | |||
119 | MOSESFrameDilation = 100, | ||
120 | MOSESUsersLoggingIn = 101, | ||
121 | MOSESTotalGeoPrim = 102, | ||
122 | MOSESTotalMesh = 103, | ||
123 | MOSESThreadCount = 104 | ||
117 | } | 124 | } |
118 | 125 | ||
119 | /// <summary> | 126 | /// <summary> |
@@ -170,7 +177,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
170 | /// <summary> | 177 | /// <summary> |
171 | /// Our nominal fps target, as expected in fps stats when a sim is running normally. | 178 | /// Our nominal fps target, as expected in fps stats when a sim is running normally. |
172 | /// </summary> | 179 | /// </summary> |
173 | private float m_nominalReportedFps = 55; | 180 | private float m_nominalReportedFps = 11; |
174 | 181 | ||
175 | /// <summary> | 182 | /// <summary> |
176 | /// Parameter to adjust reported scene fps | 183 | /// Parameter to adjust reported scene fps |
@@ -197,17 +204,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | /// </summary> | 204 | /// </summary> |
198 | private int m_objectUpdates; | 205 | private int m_objectUpdates; |
199 | 206 | ||
200 | private int m_frameMS; | 207 | private float m_frameMS; |
201 | 208 | ||
202 | private int m_netMS; | 209 | private float m_netMS; |
203 | private int m_agentMS; | 210 | private float m_agentMS; |
204 | private int m_physicsMS; | 211 | private float m_physicsMS; |
205 | private int m_imageMS; | 212 | private float m_imageMS; |
206 | private int m_otherMS; | 213 | private float m_otherMS; |
207 | private int m_sleeptimeMS; | 214 | private float m_sleeptimeMS; |
208 | |||
209 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. | ||
210 | //Ckrinke private int m_scriptMS = 0; | ||
211 | 215 | ||
212 | private int m_rootAgents; | 216 | private int m_rootAgents; |
213 | private int m_childAgents; | 217 | private int m_childAgents; |
@@ -221,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
221 | private int m_pendingDownloads; | 225 | private int m_pendingDownloads; |
222 | private int m_pendingUploads = 0; // FIXME: Not currently filled in | 226 | private int m_pendingUploads = 0; // FIXME: Not currently filled in |
223 | private int m_activeScripts; | 227 | private int m_activeScripts; |
224 | private int m_scriptLinesPerSecond; | 228 | // private int m_scriptLinesPerSecond; |
225 | 229 | ||
226 | private int m_objectCapacity = 45000; | 230 | private int m_objectCapacity = 45000; |
227 | 231 | ||
@@ -264,8 +268,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | public SimStatsReporter(Scene scene) | 268 | public SimStatsReporter(Scene scene) |
265 | { | 269 | { |
266 | m_scene = scene; | 270 | m_scene = scene; |
267 | m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; | 271 | // m_reportedFpsCorrectionFactor = 5.0f; // needs to come from config |
268 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 272 | m_reportedFpsCorrectionFactor = 1.0f; // needs to come from config |
273 | m_nominalReportedFps *= m_reportedFpsCorrectionFactor; | ||
274 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f); | ||
269 | ReportingRegion = scene.RegionInfo; | 275 | ReportingRegion = scene.RegionInfo; |
270 | 276 | ||
271 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; | 277 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; |
@@ -310,7 +316,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | public void SetUpdateMS(int ms) | 316 | public void SetUpdateMS(int ms) |
311 | { | 317 | { |
312 | m_statsUpdatesEveryMS = ms; | 318 | m_statsUpdatesEveryMS = ms; |
313 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 319 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f); |
314 | m_report.Interval = m_statsUpdatesEveryMS; | 320 | m_report.Interval = m_statsUpdatesEveryMS; |
315 | } | 321 | } |
316 | 322 | ||
@@ -333,8 +339,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
333 | if (!m_scene.Active) | 339 | if (!m_scene.Active) |
334 | return; | 340 | return; |
335 | 341 | ||
336 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; | 342 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; |
337 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 343 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
338 | 344 | ||
339 | // Know what's not thread safe in Mono... modifying timers. | 345 | // Know what's not thread safe in Mono... modifying timers. |
340 | // m_log.Debug("Firing Stats Heart Beat"); | 346 | // m_log.Debug("Firing Stats Heart Beat"); |
@@ -354,21 +360,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
354 | } | 360 | } |
355 | 361 | ||
356 | #region various statistic googly moogly | 362 | #region various statistic googly moogly |
357 | 363 | int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | |
358 | // ORIGINAL code commented out until we have time to add our own | ||
359 | // statistics to the statistics window, this will be done as a | ||
360 | // new section given the title of our current project | ||
361 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently | ||
362 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. | ||
363 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | ||
364 | int reportedFPS = m_fps; | ||
365 | 364 | ||
366 | // save the reported value so there is something available for llGetRegionFPS | 365 | // save the reported value so there is something available for llGetRegionFPS |
367 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; | 366 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; |
368 | 367 | ||
369 | // ORIGINAL code commented out until we have time to add our own | 368 | // ORIGINAL code commented out until we have time to add our own |
370 | // statistics to the statistics window | 369 | // statistics to the statistics window |
371 | float physfps = ((m_pfps / 1000)); | 370 | float physfps = ((m_pfps / 1000.0f)); |
372 | 371 | ||
373 | //if (physfps > 600) | 372 | //if (physfps > 600) |
374 | //physfps = physfps - (physfps - 600); | 373 | //physfps = physfps - (physfps - 600); |
@@ -377,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | physfps = 0; | 376 | physfps = 0; |
378 | 377 | ||
379 | #endregion | 378 | #endregion |
380 | float factor = 1 / m_statsUpdateFactor; | 379 | float factor = 1.0f / m_statsUpdateFactor; |
381 | 380 | ||
382 | if (reportedFPS <= 0) | 381 | if (reportedFPS <= 0) |
383 | reportedFPS = 1; | 382 | reportedFPS = 1; |
@@ -386,7 +385,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
386 | 385 | ||
387 | float TotalFrameTime = m_frameMS * perframe; | 386 | float TotalFrameTime = m_frameMS * perframe; |
388 | 387 | ||
389 | float targetframetime = 1100.0f / (float)m_nominalReportedFps; | 388 | float targetframetime = 1000.0f / (float)m_nominalReportedFps; |
390 | 389 | ||
391 | float sparetime; | 390 | float sparetime; |
392 | float sleeptime; | 391 | float sleeptime; |
@@ -431,10 +430,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
431 | { | 430 | { |
432 | sb[i] = new SimStatsPacket.StatBlock(); | 431 | sb[i] = new SimStatsPacket.StatBlock(); |
433 | } | 432 | } |
434 | 433 | ||
435 | |||
436 | sb[0].StatID = (uint) Stats.TimeDilation; | 434 | sb[0].StatID = (uint) Stats.TimeDilation; |
437 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 435 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; |
438 | 436 | ||
439 | sb[1].StatID = (uint) Stats.SimFPS; | 437 | sb[1].StatID = (uint) Stats.SimFPS; |
440 | sb[1].StatValue = reportedFPS / m_statsUpdateFactor; | 438 | sb[1].StatValue = reportedFPS / m_statsUpdateFactor; |
@@ -493,14 +491,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
493 | sb[19].StatID = (uint)Stats.ActiveScripts; | 491 | sb[19].StatID = (uint)Stats.ActiveScripts; |
494 | sb[19].StatValue = m_activeScripts; | 492 | sb[19].StatValue = m_activeScripts; |
495 | 493 | ||
496 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; | 494 | sb[20].StatID = (uint)Stats.SimSpareMs; |
497 | sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor; | 495 | sb[20].StatValue = sparetime; |
498 | 496 | ||
499 | sb[21].StatID = (uint)Stats.SimSpareMs; | 497 | sb[21].StatID = (uint)Stats.SimSleepMs; |
500 | sb[21].StatValue = sparetime; | 498 | sb[21].StatValue = sleeptime; |
501 | 499 | ||
502 | sb[22].StatID = (uint)Stats.SimSleepMs; | 500 | // this should came from phys engine |
503 | sb[22].StatValue = sleeptime; | 501 | sb[22].StatID = (uint)Stats.SimPhysicsStepMs; |
502 | sb[22].StatValue = 20; | ||
504 | 503 | ||
505 | for (int i = 0; i < 23; i++) | 504 | for (int i = 0; i < 23; i++) |
506 | { | 505 | { |
@@ -563,7 +562,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
563 | //m_inPacketsPerSecond = 0; | 562 | //m_inPacketsPerSecond = 0; |
564 | //m_outPacketsPerSecond = 0; | 563 | //m_outPacketsPerSecond = 0; |
565 | m_unAckedBytes = 0; | 564 | m_unAckedBytes = 0; |
566 | m_scriptLinesPerSecond = 0; | 565 | // m_scriptLinesPerSecond = 0; |
567 | 566 | ||
568 | m_frameMS = 0; | 567 | m_frameMS = 0; |
569 | m_agentMS = 0; | 568 | m_agentMS = 0; |
@@ -571,7 +570,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
571 | m_physicsMS = 0; | 570 | m_physicsMS = 0; |
572 | m_imageMS = 0; | 571 | m_imageMS = 0; |
573 | m_otherMS = 0; | 572 | m_otherMS = 0; |
574 | // m_spareMS = 0; | ||
575 | m_sleeptimeMS = 0; | 573 | m_sleeptimeMS = 0; |
576 | 574 | ||
577 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 575 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
@@ -646,7 +644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
646 | if (m_unAckedBytes < 0) m_unAckedBytes = 0; | 644 | if (m_unAckedBytes < 0) m_unAckedBytes = 0; |
647 | } | 645 | } |
648 | 646 | ||
649 | public void addFrameMS(int ms) | 647 | public void addFrameMS(float ms) |
650 | { | 648 | { |
651 | m_frameMS += ms; | 649 | m_frameMS += ms; |
652 | 650 | ||
@@ -656,32 +654,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
656 | SlowFramesStat.Value++; | 654 | SlowFramesStat.Value++; |
657 | } | 655 | } |
658 | 656 | ||
659 | public void addNetMS(int ms) | 657 | public void addNetMS(float ms) |
660 | { | 658 | { |
661 | m_netMS += ms; | 659 | m_netMS += ms; |
662 | } | 660 | } |
663 | 661 | ||
664 | public void addAgentMS(int ms) | 662 | public void addAgentMS(float ms) |
665 | { | 663 | { |
666 | m_agentMS += ms; | 664 | m_agentMS += ms; |
667 | } | 665 | } |
668 | 666 | ||
669 | public void addPhysicsMS(int ms) | 667 | public void addPhysicsMS(float ms) |
670 | { | 668 | { |
671 | m_physicsMS += ms; | 669 | m_physicsMS += ms; |
672 | } | 670 | } |
673 | 671 | ||
674 | public void addImageMS(int ms) | 672 | public void addImageMS(float ms) |
675 | { | 673 | { |
676 | m_imageMS += ms; | 674 | m_imageMS += ms; |
677 | } | 675 | } |
678 | 676 | ||
679 | public void addOtherMS(int ms) | 677 | public void addOtherMS(float ms) |
680 | { | 678 | { |
681 | m_otherMS += ms; | 679 | m_otherMS += ms; |
682 | } | 680 | } |
683 | 681 | ||
684 | public void addSleepMS(int ms) | 682 | public void addSleepMS(float ms) |
685 | { | 683 | { |
686 | m_sleeptimeMS += ms; | 684 | m_sleeptimeMS += ms; |
687 | } | 685 | } |
@@ -698,7 +696,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
698 | 696 | ||
699 | public void addScriptLines(int count) | 697 | public void addScriptLines(int count) |
700 | { | 698 | { |
701 | m_scriptLinesPerSecond += count; | 699 | // we need events not lines |
700 | // m_scriptLinesPerSecond += count; | ||
702 | } | 701 | } |
703 | 702 | ||
704 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) | 703 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) |