diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/Scene.cs | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 2a69ee1..24c95d1 100755 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -445,6 +445,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
445 | private int m_lastMaintenanceTick; | 445 | private int m_lastMaintenanceTick; |
446 | 446 | ||
447 | /// <summary> | 447 | /// <summary> |
448 | /// Total script execution time (in Stopwatch Ticks) since the last frame | ||
449 | /// </summary> | ||
450 | private long m_scriptExecutionTime = 0; | ||
451 | |||
452 | /// <summary> | ||
448 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched | 453 | /// Signals whether temporary objects are currently being cleaned up. Needed because this is launched |
449 | /// asynchronously from the update loop. | 454 | /// asynchronously from the update loop. |
450 | /// </summary> | 455 | /// </summary> |
@@ -1926,6 +1931,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1926 | StatsReporter.addOtherMS(otherMS); | 1931 | StatsReporter.addOtherMS(otherMS); |
1927 | StatsReporter.AddSpareMS(spareMS); | 1932 | StatsReporter.AddSpareMS(spareMS); |
1928 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); | 1933 | StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); |
1934 | StatsReporter.AddScriptMS((int) GetAndResetScriptExecutionTime()); | ||
1929 | 1935 | ||
1930 | // Send the correct time values to the stats reporter for the | 1936 | // Send the correct time values to the stats reporter for the |
1931 | // frame times | 1937 | // frame times |
@@ -1953,6 +1959,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
1953 | return spareMS >= 0; | 1959 | return spareMS >= 0; |
1954 | } | 1960 | } |
1955 | 1961 | ||
1962 | /// <summary> | ||
1963 | /// Adds the execution time of one script to the total scripts execution time for this region. | ||
1964 | /// </summary> | ||
1965 | /// <param name="ticks">Elapsed Stopwatch ticks</param> | ||
1966 | public void AddScriptExecutionTime(long ticks) | ||
1967 | { | ||
1968 | Interlocked.Add(ref m_scriptExecutionTime, ticks); | ||
1969 | } | ||
1970 | |||
1971 | /// <summary> | ||
1972 | /// Returns the total execution time of all the scripts in the region since the last frame | ||
1973 | /// (in milliseconds), and clears the value in preparation for the next frame. | ||
1974 | /// </summary> | ||
1975 | /// <returns>Time in milliseconds</returns> | ||
1976 | private long GetAndResetScriptExecutionTime() | ||
1977 | { | ||
1978 | long ticks = Interlocked.Exchange(ref m_scriptExecutionTime, 0); | ||
1979 | return (ticks * 1000) / Stopwatch.Frequency; | ||
1980 | } | ||
1981 | |||
1956 | public void AddGroupTarget(SceneObjectGroup grp) | 1982 | public void AddGroupTarget(SceneObjectGroup grp) |
1957 | { | 1983 | { |
1958 | lock (m_groupsWithTargets) | 1984 | lock (m_groupsWithTargets) |