aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/Scene.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-05 22:08:56 +0100
committerJustin Clark-Casey (justincc)2011-10-05 22:08:56 +0100
commit7d033187d8fd49d9a38531061c38783e81d69f5b (patch)
treefbac35fcb4e28425c4b0d1baf059fcb4087a8278 /OpenSim/Region/Framework/Scenes/Scene.cs
parentRemoved redundant scene presence lookups in HGMessageTransferModule (diff)
downloadopensim-SC_OLD-7d033187d8fd49d9a38531061c38783e81d69f5b.zip
opensim-SC_OLD-7d033187d8fd49d9a38531061c38783e81d69f5b.tar.gz
opensim-SC_OLD-7d033187d8fd49d9a38531061c38783e81d69f5b.tar.bz2
opensim-SC_OLD-7d033187d8fd49d9a38531061c38783e81d69f5b.tar.xz
Make reported sim fps more accurate, in line with frame time ms
Also remove some unused fields and improve naming on others.
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs26
1 files changed, 18 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 29a54e8..e4ebcff 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -137,8 +137,6 @@ namespace OpenSim.Region.Framework.Scenes
137 protected IDialogModule m_dialogModule; 137 protected IDialogModule m_dialogModule;
138 protected IEntityTransferModule m_teleportModule; 138 protected IEntityTransferModule m_teleportModule;
139 protected ICapabilitiesModule m_capsModule; 139 protected ICapabilitiesModule m_capsModule;
140 // Central Update Loop
141 protected int m_fps = 10;
142 140
143 /// <summary> 141 /// <summary>
144 /// Current scene frame number 142 /// Current scene frame number
@@ -149,8 +147,20 @@ namespace OpenSim.Region.Framework.Scenes
149 protected set; 147 protected set;
150 } 148 }
151 149
152 protected float m_timespan = 0.089f; 150 /// <summary>
153 protected DateTime m_lastupdate = DateTime.UtcNow; 151 /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we
152 /// will sleep for the remaining period.
153 /// </summary>
154 /// <remarks>
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).
157 /// </remarks>
158 protected float m_minFrameTimespan = 0.089f;
159
160 /// <summary>
161 /// The time of the last frame update.
162 /// </summary>
163 protected DateTime m_lastFrameUpdate = DateTime.UtcNow;
154 164
155 // TODO: Possibly stop other classes being able to manipulate this directly. 165 // TODO: Possibly stop other classes being able to manipulate this directly.
156 private SceneGraph m_sceneGraph; 166 private SceneGraph m_sceneGraph;
@@ -1211,7 +1221,7 @@ namespace OpenSim.Region.Framework.Scenes
1211 1221
1212 public override void Update() 1222 public override void Update()
1213 { 1223 {
1214 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1224 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate;
1215 float physicsFPS = 0f; 1225 float physicsFPS = 0f;
1216 1226
1217 int maintc = Util.EnvironmentTickCount(); 1227 int maintc = Util.EnvironmentTickCount();
@@ -1263,7 +1273,7 @@ namespace OpenSim.Region.Framework.Scenes
1263 if (Frame % m_update_physics == 0) 1273 if (Frame % m_update_physics == 0)
1264 { 1274 {
1265 if (m_physics_enabled) 1275 if (m_physics_enabled)
1266 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); 1276 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_minFrameTimespan));
1267 if (SynchronizeScene != null) 1277 if (SynchronizeScene != null)
1268 SynchronizeScene(this); 1278 SynchronizeScene(this);
1269 } 1279 }
@@ -1379,11 +1389,11 @@ namespace OpenSim.Region.Framework.Scenes
1379 } 1389 }
1380 finally 1390 finally
1381 { 1391 {
1382 m_lastupdate = DateTime.UtcNow; 1392 m_lastFrameUpdate = DateTime.UtcNow;
1383 } 1393 }
1384 1394
1385 maintc = Util.EnvironmentTickCountSubtract(maintc); 1395 maintc = Util.EnvironmentTickCountSubtract(maintc);
1386 maintc = (int)(m_timespan * 1000) - maintc; 1396 maintc = (int)(m_minFrameTimespan * 1000) - maintc;
1387 1397
1388 if (maintc > 0) 1398 if (maintc > 0)
1389 Thread.Sleep(maintc); 1399 Thread.Sleep(maintc);