aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie2011-10-12 01:41:28 +0100
committerMelanie2011-10-12 01:41:28 +0100
commite68226afd3fd42f776a330aeb36354411854ea2d (patch)
tree196c1bc78536038a94581d322ea53b06f64cb810 /OpenSim
parentMerge commit '3142982353a121920e571e5b33acffc065b20a2e' into bigmerge (diff)
parentMake reported sim fps more accurate, in line with frame time ms (diff)
downloadopensim-SC_OLD-e68226afd3fd42f776a330aeb36354411854ea2d.zip
opensim-SC_OLD-e68226afd3fd42f776a330aeb36354411854ea2d.tar.gz
opensim-SC_OLD-e68226afd3fd42f776a330aeb36354411854ea2d.tar.bz2
opensim-SC_OLD-e68226afd3fd42f776a330aeb36354411854ea2d.tar.xz
Merge commit '7d033187d8fd49d9a38531061c38783e81d69f5b' into bigmerge
Diffstat (limited to 'OpenSim')
-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 b288c8a..1acd607 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -140,8 +140,6 @@ namespace OpenSim.Region.Framework.Scenes
140 protected IDialogModule m_dialogModule; 140 protected IDialogModule m_dialogModule;
141 protected IEntityTransferModule m_teleportModule; 141 protected IEntityTransferModule m_teleportModule;
142 protected ICapabilitiesModule m_capsModule; 142 protected ICapabilitiesModule m_capsModule;
143 // Central Update Loop
144 protected int m_fps = 10;
145 143
146 /// <summary> 144 /// <summary>
147 /// Current scene frame number 145 /// Current scene frame number
@@ -152,8 +150,20 @@ namespace OpenSim.Region.Framework.Scenes
152 protected set; 150 protected set;
153 } 151 }
154 152
155 protected float m_timespan = 0.089f; 153 /// <summary>
156 protected DateTime m_lastupdate = DateTime.UtcNow; 154 /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we
155 /// will sleep for the remaining period.
156 /// </summary>
157 /// <remarks>
158 /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations
159 /// occur too quickly (viewer 1) or with even more slide (viewer 2).
160 /// </remarks>
161 protected float m_minFrameTimespan = 0.089f;
162
163 /// <summary>
164 /// The time of the last frame update.
165 /// </summary>
166 protected DateTime m_lastFrameUpdate = DateTime.UtcNow;
157 167
158 // TODO: Possibly stop other classes being able to manipulate this directly. 168 // TODO: Possibly stop other classes being able to manipulate this directly.
159 private SceneGraph m_sceneGraph; 169 private SceneGraph m_sceneGraph;
@@ -1236,7 +1246,7 @@ namespace OpenSim.Region.Framework.Scenes
1236 1246
1237 public override void Update() 1247 public override void Update()
1238 { 1248 {
1239 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; 1249 TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate;
1240 float physicsFPS = 0f; 1250 float physicsFPS = 0f;
1241 1251
1242 int maintc = Util.EnvironmentTickCount(); 1252 int maintc = Util.EnvironmentTickCount();
@@ -1288,7 +1298,7 @@ namespace OpenSim.Region.Framework.Scenes
1288 if (Frame % m_update_physics == 0) 1298 if (Frame % m_update_physics == 0)
1289 { 1299 {
1290 if (m_physics_enabled) 1300 if (m_physics_enabled)
1291 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); 1301 physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_minFrameTimespan));
1292 if (SynchronizeScene != null) 1302 if (SynchronizeScene != null)
1293 SynchronizeScene(this); 1303 SynchronizeScene(this);
1294 } 1304 }
@@ -1411,11 +1421,11 @@ namespace OpenSim.Region.Framework.Scenes
1411 } 1421 }
1412 finally 1422 finally
1413 { 1423 {
1414 m_lastupdate = DateTime.UtcNow; 1424 m_lastFrameUpdate = DateTime.UtcNow;
1415 } 1425 }
1416 1426
1417 maintc = Util.EnvironmentTickCountSubtract(maintc); 1427 maintc = Util.EnvironmentTickCountSubtract(maintc);
1418 maintc = (int)(m_timespan * 1000) - maintc; 1428 maintc = (int)(m_minFrameTimespan * 1000) - maintc;
1419 1429
1420 1430
1421 m_lastUpdate = Util.EnvironmentTickCount(); 1431 m_lastUpdate = Util.EnvironmentTickCount();
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
index d1ee990..afa6e89 100644
--- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs
@@ -188,6 +188,11 @@ namespace OpenSim.Region.Framework.Scenes
188 }); 188 });
189 } 189 }
190 190
191 /// <summary>
192 /// Perform a physics frame update.
193 /// </summary>
194 /// <param name="elapsed"></param>
195 /// <returns></returns>
191 protected internal float UpdatePhysics(double elapsed) 196 protected internal float UpdatePhysics(double elapsed)
192 { 197 {
193 lock (m_syncRoot) 198 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;