diff options
author | Steven Zielinski | 2015-04-21 15:33:54 -0400 |
---|---|---|
committer | Diva Canto | 2015-04-29 18:22:24 -0700 |
commit | 59778cfc2abc807792b64e9392ad3009aaf07ecb (patch) | |
tree | 7380029639693b135c2aa31c9ecbb3acad78d663 /OpenSim/Region/Framework/Scenes/Scene.cs | |
parent | Revert "Enable grab feature (Ctrl+Drag) for non-physical link-sets and add co... (diff) | |
download | opensim-SC_OLD-59778cfc2abc807792b64e9392ad3009aaf07ecb.zip opensim-SC_OLD-59778cfc2abc807792b64e9392ad3009aaf07ecb.tar.gz opensim-SC_OLD-59778cfc2abc807792b64e9392ad3009aaf07ecb.tar.bz2 opensim-SC_OLD-59778cfc2abc807792b64e9392ad3009aaf07ecb.tar.xz |
Added in all metrics for Phase 1 except for Time Dilation.
Test Plan:
Tested on local opensim and firestorm. Not tested with JSON stats
reporter.
Reviewers: rlouden
Reviewed By: rlouden
Differential Revision: http://cr.irl.ucf.edu/D269
Signed-off-by: Diva Canto <diva@metaverseink.com>
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-x[-rw-r--r--] | OpenSim/Region/Framework/Scenes/Scene.cs | 104 |
1 files changed, 103 insertions, 1 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 4715558..906c862 100644..100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -1107,7 +1107,27 @@ namespace OpenSim.Region.Framework.Scenes | |||
1107 | 1107 | ||
1108 | #endregion Interest Management | 1108 | #endregion Interest Management |
1109 | 1109 | ||
1110 | StatsReporter = new SimStatsReporter(this); | 1110 | // Acquire the statistics section of the OpenSim.ini file located |
1111 | // in the bin directory | ||
1112 | IConfig statisticsConfig = m_config.Configs["Statistics"]; | ||
1113 | |||
1114 | // Confirm that the statistics section existed in the configuration | ||
1115 | // file | ||
1116 | if (statisticsConfig != null) | ||
1117 | { | ||
1118 | // Create the StatsReporter using the number of frames to store | ||
1119 | // for the frame time statistics, or 10 frames if the config | ||
1120 | // file doesn't contain a value | ||
1121 | StatsReporter = new SimStatsReporter(this, | ||
1122 | statisticsConfig.GetInt("NumberOfFrames", 10)); | ||
1123 | } | ||
1124 | else | ||
1125 | { | ||
1126 | // Create a StatsReporter with the current scene and a default | ||
1127 | // 10 frames stored for the frame time statistics | ||
1128 | StatsReporter = new SimStatsReporter(this); | ||
1129 | } | ||
1130 | |||
1111 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; | 1131 | StatsReporter.OnSendStatsResult += SendSimStatsPackets; |
1112 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; | 1132 | StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; |
1113 | 1133 | ||
@@ -1607,6 +1627,21 @@ namespace OpenSim.Region.Framework.Scenes | |||
1607 | float physicsFPS = 0f; | 1627 | float physicsFPS = 0f; |
1608 | int previousFrameTick, tmpMS; | 1628 | int previousFrameTick, tmpMS; |
1609 | 1629 | ||
1630 | // These variables will be used to save the precise frame time using the | ||
1631 | // Stopwatch class of Microsoft SDK; the times are recorded at the start | ||
1632 | // and end of a particular section of code, and then used to calculate | ||
1633 | // the frame times, which are the sums of the sections for each given name | ||
1634 | double preciseTotalFrameTime = 0.0; | ||
1635 | double preciseSimFrameTime = 0.0; | ||
1636 | double precisePhysicsFrameTime = 0.0; | ||
1637 | Stopwatch totalFrameStopwatch = new Stopwatch(); | ||
1638 | Stopwatch simFrameStopwatch = new Stopwatch(); | ||
1639 | Stopwatch physicsFrameStopwatch = new Stopwatch(); | ||
1640 | |||
1641 | // Begin the stopwatch to keep track of the time that the frame | ||
1642 | // started running to determine how long the frame took to complete | ||
1643 | totalFrameStopwatch.Start(); | ||
1644 | |||
1610 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) | 1645 | while (!m_shuttingDown && ((endFrame == null && Active) || Frame < endFrame)) |
1611 | { | 1646 | { |
1612 | ++Frame; | 1647 | ++Frame; |
@@ -1622,25 +1657,62 @@ namespace OpenSim.Region.Framework.Scenes | |||
1622 | // Apply taints in terrain module to terrain in physics scene | 1657 | // Apply taints in terrain module to terrain in physics scene |
1623 | if (Frame % m_update_terrain == 0) | 1658 | if (Frame % m_update_terrain == 0) |
1624 | { | 1659 | { |
1660 | // At several points inside the code there was a need to | ||
1661 | // create a more precise measurement of time elapsed. | ||
1662 | // This led to the addition of variables that have a | ||
1663 | // similar function and thus remain tightly connected to | ||
1664 | // their original counterparts. However, the original | ||
1665 | // code is not receiving comments from our group because | ||
1666 | // we don't feel right modifying the code to that degree | ||
1667 | // at this point in time, the precise values all begin | ||
1668 | // with the keyword precise | ||
1625 | tmpMS = Util.EnvironmentTickCount(); | 1669 | tmpMS = Util.EnvironmentTickCount(); |
1670 | |||
1671 | simFrameStopwatch.Start(); | ||
1626 | UpdateTerrain(); | 1672 | UpdateTerrain(); |
1673 | |||
1674 | // Get the simulation frame time that the avatar force | ||
1675 | // input took | ||
1676 | simFrameStopwatch.Stop(); | ||
1677 | preciseSimFrameTime = | ||
1678 | simFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1627 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1679 | terrainMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1628 | } | 1680 | } |
1629 | 1681 | ||
1630 | tmpMS = Util.EnvironmentTickCount(); | 1682 | tmpMS = Util.EnvironmentTickCount(); |
1683 | |||
1684 | // Begin the stopwatch to track the time to prepare physics | ||
1685 | physicsFrameStopwatch.Start(); | ||
1631 | if (PhysicsEnabled && Frame % m_update_physics == 0) | 1686 | if (PhysicsEnabled && Frame % m_update_physics == 0) |
1632 | m_sceneGraph.UpdatePreparePhysics(); | 1687 | m_sceneGraph.UpdatePreparePhysics(); |
1688 | |||
1689 | // Get the time it took to prepare the physics, this | ||
1690 | // would report the most precise time that physics was | ||
1691 | // running on the machine and should the physics not be | ||
1692 | // enabled will report the time it took to check if physics | ||
1693 | // was enabled | ||
1694 | physicsFrameStopwatch.Stop(); | ||
1695 | precisePhysicsFrameTime = | ||
1696 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1633 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); | 1697 | physicsMS2 = Util.EnvironmentTickCountSubtract(tmpMS); |
1634 | 1698 | ||
1635 | // Apply any pending avatar force input to the avatar's velocity | 1699 | // Apply any pending avatar force input to the avatar's velocity |
1636 | tmpMS = Util.EnvironmentTickCount(); | 1700 | tmpMS = Util.EnvironmentTickCount(); |
1701 | simFrameStopwatch.Restart(); | ||
1637 | if (Frame % m_update_entitymovement == 0) | 1702 | if (Frame % m_update_entitymovement == 0) |
1638 | m_sceneGraph.UpdateScenePresenceMovement(); | 1703 | m_sceneGraph.UpdateScenePresenceMovement(); |
1704 | |||
1705 | // Get the simulation frame time that the avatar force input | ||
1706 | // took | ||
1707 | simFrameStopwatch.Stop(); | ||
1708 | preciseSimFrameTime += | ||
1709 | simFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1639 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1710 | agentMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1640 | 1711 | ||
1641 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1712 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1642 | // velocity | 1713 | // velocity |
1643 | tmpMS = Util.EnvironmentTickCount(); | 1714 | tmpMS = Util.EnvironmentTickCount(); |
1715 | physicsFrameStopwatch.Restart(); | ||
1644 | if (Frame % m_update_physics == 0) | 1716 | if (Frame % m_update_physics == 0) |
1645 | { | 1717 | { |
1646 | if (PhysicsEnabled) | 1718 | if (PhysicsEnabled) |
@@ -1649,8 +1721,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
1649 | if (SynchronizeScene != null) | 1721 | if (SynchronizeScene != null) |
1650 | SynchronizeScene(this); | 1722 | SynchronizeScene(this); |
1651 | } | 1723 | } |
1724 | |||
1725 | // Add the main physics update time to the prepare physics | ||
1726 | // time | ||
1727 | physicsFrameStopwatch.Stop(); | ||
1728 | precisePhysicsFrameTime += | ||
1729 | physicsFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1652 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); | 1730 | physicsMS = Util.EnvironmentTickCountSubtract(tmpMS); |
1653 | 1731 | ||
1732 | // Start the stopwatch for the remainder of the simulation | ||
1733 | simFrameStopwatch.Restart(); | ||
1654 | tmpMS = Util.EnvironmentTickCount(); | 1734 | tmpMS = Util.EnvironmentTickCount(); |
1655 | 1735 | ||
1656 | // Check if any objects have reached their targets | 1736 | // Check if any objects have reached their targets |
@@ -1738,6 +1818,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1738 | EventManager.TriggerRegionHeartbeatEnd(this); | 1818 | EventManager.TriggerRegionHeartbeatEnd(this); |
1739 | otherMS = eventMS + backupMS + terrainMS + landMS; | 1819 | otherMS = eventMS + backupMS + terrainMS + landMS; |
1740 | 1820 | ||
1821 | // Get the elapsed time for the simulation frame | ||
1822 | simFrameStopwatch.Stop(); | ||
1823 | preciseSimFrameTime += | ||
1824 | simFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1825 | |||
1741 | if (!UpdateOnTimer) | 1826 | if (!UpdateOnTimer) |
1742 | { | 1827 | { |
1743 | Watchdog.UpdateThread(); | 1828 | Watchdog.UpdateThread(); |
@@ -1754,6 +1839,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1754 | spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS); | 1839 | spareMS = Math.Max(0, MinFrameTicks - physicsMS2 - agentMS - physicsMS - otherMS); |
1755 | } | 1840 | } |
1756 | 1841 | ||
1842 | // Get the total frame time | ||
1843 | totalFrameStopwatch.Stop(); | ||
1844 | preciseTotalFrameTime = | ||
1845 | totalFrameStopwatch.Elapsed.TotalMilliseconds; | ||
1846 | |||
1847 | // Restart the stopwatch for the total time of the next frame | ||
1848 | totalFrameStopwatch.Restart(); | ||
1849 | |||
1757 | previousFrameTick = m_lastFrameTick; | 1850 | previousFrameTick = m_lastFrameTick; |
1758 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); | 1851 | frameMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick); |
1759 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1852 | m_lastFrameTick = Util.EnvironmentTickCount(); |
@@ -1771,6 +1864,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1771 | StatsReporter.AddSpareMS(spareMS); | 1864 | StatsReporter.AddSpareMS(spareMS); |
1772 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | 1865 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); |
1773 | 1866 | ||
1867 | // Send the correct time values to the stats reporter for the | ||
1868 | // frame times | ||
1869 | StatsReporter.addFrameTimeMilliseconds(preciseTotalFrameTime, | ||
1870 | preciseSimFrameTime, precisePhysicsFrameTime, 0.0); | ||
1871 | |||
1872 | // Send the correct number of frames that the physics library | ||
1873 | // has processed to the stats reporter | ||
1874 | StatsReporter.addPhysicsFrame(1); | ||
1875 | |||
1774 | // Optionally warn if a frame takes double the amount of time that it should. | 1876 | // Optionally warn if a frame takes double the amount of time that it should. |
1775 | if (DebugUpdates | 1877 | if (DebugUpdates |
1776 | && Util.EnvironmentTickCountSubtract( | 1878 | && Util.EnvironmentTickCountSubtract( |