aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-13 22:07:55 +0100
committerJustin Clark-Casey (justincc)2011-10-13 22:07:55 +0100
commita6fa15e8b65a123d79a1bea8cccb459f76139314 (patch)
treecb1aea66d8bcc959df26d0216894c51d905e6012
parentMove fps stat adjustment factor into field rather than hard-coded. (diff)
downloadopensim-SC_OLD-a6fa15e8b65a123d79a1bea8cccb459f76139314.zip
opensim-SC_OLD-a6fa15e8b65a123d79a1bea8cccb459f76139314.tar.gz
opensim-SC_OLD-a6fa15e8b65a123d79a1bea8cccb459f76139314.tar.bz2
opensim-SC_OLD-a6fa15e8b65a123d79a1bea8cccb459f76139314.tar.xz
Tie reported FPS correction factor into the minimum frame time rather than setting separately.
This makes reported FPS scale as required if min frame time changes
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs7
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs12
2 files changed, 13 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 2c24c0f..e0b76f6 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -155,7 +155,7 @@ namespace OpenSim.Region.Framework.Scenes
155 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations 155 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
156 /// occur too quickly (viewer 1) or with even more slide (viewer 2). 156 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
157 /// </remarks> 157 /// </remarks>
158 protected float m_minFrameTimespan = 0.089f; 158 public float MinFrameTime { get; private set; }
159 159
160 /// <summary> 160 /// <summary>
161 /// The time of the last frame update. 161 /// The time of the last frame update.
@@ -533,6 +533,7 @@ namespace OpenSim.Region.Framework.Scenes
533 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion) 533 bool SeeIntoRegionFromNeighbor, IConfigSource config, string simulatorVersion)
534 { 534 {
535 m_config = config; 535 m_config = config;
536 MinFrameTime = 0.089f;
536 537
537 Random random = new Random(); 538 Random random = new Random();
538 539
@@ -1268,7 +1269,7 @@ namespace OpenSim.Region.Framework.Scenes
1268 if (Frame % m_update_physics == 0) 1269 if (Frame % m_update_physics == 0)
1269 { 1270 {
1270 if (m_physics_enabled) 1271 if (m_physics_enabled)
1271 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_minFrameTimespan)); 1272 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, MinFrameTime));
1272 if (SynchronizeScene != null) 1273 if (SynchronizeScene != null)
1273 SynchronizeScene(this); 1274 SynchronizeScene(this);
1274 } 1275 }
@@ -1389,7 +1390,7 @@ namespace OpenSim.Region.Framework.Scenes
1389 } 1390 }
1390 1391
1391 maintc = Util.EnvironmentTickCountSubtract(maintc); 1392 maintc = Util.EnvironmentTickCountSubtract(maintc);
1392 maintc = (int)(m_minFrameTimespan * 1000) - maintc; 1393 maintc = (int)(MinFrameTime * 1000) - maintc;
1393 1394
1394 if (maintc > 0) 1395 if (maintc > 0)
1395 Thread.Sleep(maintc); 1396 Thread.Sleep(maintc);
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 8d62b16..35cd025 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -107,6 +107,11 @@ namespace OpenSim.Region.Framework.Scenes
107 private int m_fps = 0; 107 private int m_fps = 0;
108 108
109 /// <summary> 109 /// <summary>
110 /// Our nominal fps target, as expected in fps stats when a sim is running normally.
111 /// </summary>
112 private float m_nominalReportedFps = 55;
113
114 /// <summary>
110 /// Parameter to adjust reported scene fps 115 /// Parameter to adjust reported scene fps
111 /// </summary> 116 /// </summary>
112 /// <remarks> 117 /// <remarks>
@@ -114,7 +119,7 @@ namespace OpenSim.Region.Framework.Scenes
114 /// However, we will still report an FPS that's closer to what people are used to seeing. A lower FPS might 119 /// However, we will still report an FPS that's closer to what people are used to seeing. A lower FPS might
115 /// affect clients and monitoring scripts/software. 120 /// affect clients and monitoring scripts/software.
116 /// </remarks> 121 /// </remarks>
117 private float m_fpsCorrectionFactor = 5; 122 private float m_reportedFpsCorrectionFactor = 5;
118 123
119 // saved last reported value so there is something available for llGetRegionFPS 124 // saved last reported value so there is something available for llGetRegionFPS
120 private float lastReportedSimFPS = 0; 125 private float lastReportedSimFPS = 0;
@@ -165,8 +170,9 @@ namespace OpenSim.Region.Framework.Scenes
165 170
166 public SimStatsReporter(Scene scene) 171 public SimStatsReporter(Scene scene)
167 { 172 {
168 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
169 m_scene = scene; 173 m_scene = scene;
174 m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps;
175 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
170 ReportingRegion = scene.RegionInfo; 176 ReportingRegion = scene.RegionInfo;
171 177
172 m_objectCapacity = scene.RegionInfo.ObjectCapacity; 178 m_objectCapacity = scene.RegionInfo.ObjectCapacity;
@@ -212,7 +218,7 @@ namespace OpenSim.Region.Framework.Scenes
212 218
213 // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently 219 // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently
214 // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. 220 // locked at a maximum of 11. Maybe at some point this can change so that we're not lying.
215 int reportedFPS = (int)(m_fps * m_fpsCorrectionFactor); 221 int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor);
216 222
217 // save the reported value so there is something available for llGetRegionFPS 223 // save the reported value so there is something available for llGetRegionFPS
218 lastReportedSimFPS = reportedFPS / statsUpdateFactor; 224 lastReportedSimFPS = reportedFPS / statsUpdateFactor;