aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneGraph.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs29
3 files changed, 36 insertions, 24 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);
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index 36c5c52..11c2a78 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -174,6 +174,11 @@ namespace OpenSim.Region.Framework.Scenes
174 }); 174 });
175 } 175 }
176 176
177 /// <summary>
178 /// Perform a physics frame update.
179 /// </summary>
180 /// <param name="elapsed"></param>
181 /// <returns></returns>
177 protected internal float UpdatePhysics(double elapsed) 182 protected internal float UpdatePhysics(double elapsed)
178 { 183 {
179 lock (m_syncRoot) 184 lock (m_syncRoot)
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 87dcdee..2d92ed8 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -37,6 +37,9 @@ namespace OpenSim.Region.Framework.Scenes
37{ 37{
38 public class SimStatsReporter 38 public class SimStatsReporter
39 { 39 {
40// private static readonly log4net.ILog m_log
41// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
42
40 public delegate void SendStatResult(SimStats stats); 43 public delegate void SendStatResult(SimStats stats);
41 44
42 public delegate void YourStatsAreWrong(); 45 public delegate void YourStatsAreWrong();
@@ -165,18 +168,9 @@ namespace OpenSim.Region.Framework.Scenes
165 168
166#region various statistic googly moogly 169#region various statistic googly moogly
167 170
168 // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there
169 // 0-50 is pretty close to 0-45
170 float simfps = (int) ((m_fps * 5));
171 // save the reported value so there is something available for llGetRegionFPS 171 // save the reported value so there is something available for llGetRegionFPS
172 lastReportedSimFPS = (float)simfps / statsUpdateFactor; 172 lastReportedSimFPS = (float)m_fps / statsUpdateFactor;
173
174 //if (simfps > 45)
175 //simfps = simfps - (simfps - 45);
176 //if (simfps < 0)
177 //simfps = 0;
178 173
179 //
180 float physfps = ((m_pfps / 1000)); 174 float physfps = ((m_pfps / 1000));
181 175
182 //if (physfps > 600) 176 //if (physfps > 600)
@@ -197,7 +191,7 @@ namespace OpenSim.Region.Framework.Scenes
197 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change 191 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
198 // values to X-per-second values. 192 // values to X-per-second values.
199 193
200 for (int i = 0; i<21;i++) 194 for (int i = 0; i < 21; i++)
201 { 195 {
202 sb[i] = new SimStatsPacket.StatBlock(); 196 sb[i] = new SimStatsPacket.StatBlock();
203 } 197 }
@@ -206,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes
206 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); 200 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
207 201
208 sb[1].StatID = (uint) Stats.SimFPS; 202 sb[1].StatID = (uint) Stats.SimFPS;
209 sb[1].StatValue = simfps/statsUpdateFactor; 203 sb[1].StatValue = m_fps/statsUpdateFactor;
210 204
211 sb[2].StatID = (uint) Stats.PhysicsFPS; 205 sb[2].StatID = (uint) Stats.PhysicsFPS;
212 sb[2].StatValue = physfps / statsUpdateFactor; 206 sb[2].StatValue = physfps / statsUpdateFactor;
@@ -272,7 +266,8 @@ namespace OpenSim.Region.Framework.Scenes
272 266
273 SimStats simStats 267 SimStats simStats
274 = new SimStats( 268 = new SimStats(
275 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); 269 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity,
270 rb, sb, m_scene.RegionInfo.originRegionID);
276 271
277 handlerSendStatResult = OnSendStatsResult; 272 handlerSendStatResult = OnSendStatsResult;
278 if (handlerSendStatResult != null) 273 if (handlerSendStatResult != null)
@@ -395,30 +390,32 @@ namespace OpenSim.Region.Framework.Scenes
395 { 390 {
396 m_frameMS += ms; 391 m_frameMS += ms;
397 } 392 }
393
398 public void addNetMS(int ms) 394 public void addNetMS(int ms)
399 { 395 {
400 m_netMS += ms; 396 m_netMS += ms;
401 } 397 }
398
402 public void addAgentMS(int ms) 399 public void addAgentMS(int ms)
403 { 400 {
404 m_agentMS += ms; 401 m_agentMS += ms;
405 } 402 }
403
406 public void addPhysicsMS(int ms) 404 public void addPhysicsMS(int ms)
407 { 405 {
408 m_physicsMS += ms; 406 m_physicsMS += ms;
409 } 407 }
408
410 public void addImageMS(int ms) 409 public void addImageMS(int ms)
411 { 410 {
412 m_imageMS += ms; 411 m_imageMS += ms;
413 } 412 }
413
414 public void addOtherMS(int ms) 414 public void addOtherMS(int ms)
415 { 415 {
416 m_otherMS += ms; 416 m_otherMS += ms;
417 } 417 }
418 418
419// private static readonly log4net.ILog m_log
420// = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
421
422 public void AddPendingDownloads(int count) 419 public void AddPendingDownloads(int count)
423 { 420 {
424 m_pendingDownloads += count; 421 m_pendingDownloads += count;