aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorUbitUmarov2015-10-12 11:29:13 +0100
committerUbitUmarov2015-10-12 11:29:13 +0100
commit8e333c953d958254670cd9ee24b49b6b1b12eca8 (patch)
treeab00ad0b734ca74b64a14abf2dafbe071ed00fd6
parent detect a fully degenerated mesh and avoid using it and so crashing ubOde (diff)
downloadopensim-SC-8e333c953d958254670cd9ee24b49b6b1b12eca8.zip
opensim-SC-8e333c953d958254670cd9ee24b49b6b1b12eca8.tar.gz
opensim-SC-8e333c953d958254670cd9ee24b49b6b1b12eca8.tar.bz2
opensim-SC-8e333c953d958254670cd9ee24b49b6b1b12eca8.tar.xz
in stats use real integration time, not the wanted one. Dont let stats calls overlap using a proper lock object
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SimStatsReporter.cs49
1 files changed, 29 insertions, 20 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index de3c3d6..7f6a1cd 100755
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -28,6 +28,7 @@
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Timers; 30using System.Timers;
31using System.Threading;
31using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
32using OpenSim.Framework; 33using OpenSim.Framework;
33using OpenSim.Framework.Monitoring; 34using OpenSim.Framework.Monitoring;
@@ -174,14 +175,11 @@ namespace OpenSim.Region.Framework.Scenes
174 175
175 // Sending a stats update every 3 seconds- 176 // Sending a stats update every 3 seconds-
176 private int m_statsUpdatesEveryMS = 3000; 177 private int m_statsUpdatesEveryMS = 3000;
177 private float m_statsUpdateFactor; 178 private double m_lastUpdateTS;
178 private float m_timeDilation; 179 private float m_timeDilation;
179 private int m_fps; 180 private int m_fps;
180 181
181 /// <summary> 182 private object m_statsLock = new object();
182 /// Number of the last frame on which we processed a stats udpate.
183 /// </summary>
184 private uint m_lastUpdateFrame;
185 183
186 /// <summary> 184 /// <summary>
187 /// Parameter to adjust reported scene fps 185 /// Parameter to adjust reported scene fps
@@ -245,7 +243,7 @@ namespace OpenSim.Region.Framework.Scenes
245 243
246 private RegionInfo ReportingRegion; 244 private RegionInfo ReportingRegion;
247 245
248 private Timer m_report = new Timer(); 246 private System.Timers.Timer m_report = new System.Timers.Timer();
249 247
250 private IEstateModule estateModule; 248 private IEstateModule estateModule;
251 249
@@ -253,7 +251,6 @@ namespace OpenSim.Region.Framework.Scenes
253 { 251 {
254 m_scene = scene; 252 m_scene = scene;
255 253
256 m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f);
257 ReportingRegion = scene.RegionInfo; 254 ReportingRegion = scene.RegionInfo;
258 255
259 m_objectCapacity = scene.RegionInfo.ObjectCapacity; 256 m_objectCapacity = scene.RegionInfo.ObjectCapacity;
@@ -262,6 +259,8 @@ namespace OpenSim.Region.Framework.Scenes
262 m_report.Elapsed += TriggerStatsHeartbeat; 259 m_report.Elapsed += TriggerStatsHeartbeat;
263 m_report.Enabled = true; 260 m_report.Enabled = true;
264 261
262 m_lastUpdateTS = Util.GetTimeStampMS();
263
265 if (StatsManager.SimExtraStats != null) 264 if (StatsManager.SimExtraStats != null)
266 OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; 265 OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket;
267 266
@@ -298,7 +297,6 @@ namespace OpenSim.Region.Framework.Scenes
298 public void SetUpdateMS(int ms) 297 public void SetUpdateMS(int ms)
299 { 298 {
300 m_statsUpdatesEveryMS = ms; 299 m_statsUpdatesEveryMS = ms;
301 m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f);
302 m_report.Interval = m_statsUpdatesEveryMS; 300 m_report.Interval = m_statsUpdatesEveryMS;
303 } 301 }
304 302
@@ -320,17 +318,18 @@ namespace OpenSim.Region.Framework.Scenes
320 { 318 {
321 if (!m_scene.Active) 319 if (!m_scene.Active)
322 return; 320 return;
323
324 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[m_statisticViewerArraySize];
325 SimStatsPacket.StatBlock[] sbex = new SimStatsPacket.StatBlock[m_statisticExtraArraySize];
326 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
327 321
328 // Know what's not thread safe in Mono... modifying timers. 322 // dont do it if if still been done
329 // m_log.Debug("Firing Stats Heart Beat"); 323
330 lock (m_report) 324 if(Monitor.TryEnter(m_statsLock))
331 { 325 {
326 // m_log.Debug("Firing Stats Heart Beat");
327
328 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[m_statisticViewerArraySize];
329 SimStatsPacket.StatBlock[] sbex = new SimStatsPacket.StatBlock[m_statisticExtraArraySize];
330 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
332 uint regionFlags = 0; 331 uint regionFlags = 0;
333 332
334 try 333 try
335 { 334 {
336 if (estateModule == null) 335 if (estateModule == null)
@@ -343,6 +342,11 @@ namespace OpenSim.Region.Framework.Scenes
343 } 342 }
344 343
345#region various statistic googly moogly 344#region various statistic googly moogly
345 double timeTmp = m_lastUpdateTS;
346 m_lastUpdateTS = Util.GetTimeStampMS();
347
348 float m_statsUpdateFactor = (float)((m_lastUpdateTS - timeTmp)/1000.0);
349
346 // factor to consider updates integration time 350 // factor to consider updates integration time
347 float updateFactor = 1.0f / m_statsUpdateFactor; 351 float updateFactor = 1.0f / m_statsUpdateFactor;
348 352
@@ -362,8 +366,8 @@ namespace OpenSim.Region.Framework.Scenes
362 // save the reported value so there is something available for llGetRegionFPS 366 // save the reported value so there is something available for llGetRegionFPS
363 lastReportedSimFPS = reportedFPS; 367 lastReportedSimFPS = reportedFPS;
364 368
365
366#endregion 369#endregion
370
367 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); 371 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
368 m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); 372 m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
369 m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount(); 373 m_numPrim = m_scene.SceneGraph.GetTotalObjectsCount();
@@ -372,9 +376,11 @@ namespace OpenSim.Region.Framework.Scenes
372 m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); 376 m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount();
373 m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); 377 m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount();
374 378
375 float physfps = m_pfps; 379 float physfps = m_pfps * updateFactor;
376 if (physfps < 0) 380 if (physfps < 0)
377 physfps = 0; 381 physfps = 0;
382 else if(physfps > reportedFPS)
383 physfps = reportedFPS; // pretend we are not insane
378 384
379 float sparetime; 385 float sparetime;
380 float sleeptime; 386 float sleeptime;
@@ -390,7 +396,9 @@ namespace OpenSim.Region.Framework.Scenes
390 else if (sparetime > TotalFrameTime) 396 else if (sparetime > TotalFrameTime)
391 sparetime = TotalFrameTime; 397 sparetime = TotalFrameTime;
392 398
393 399 // don't send meaning less precision
400 reportedFPS = (float)Math.Round(reportedFPS,1);
401 physfps = (float)Math.Round(physfps,1);
394 402
395 // FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code 403 // FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code
396 // so that stat numbers are always consistent. 404 // so that stat numbers are always consistent.
@@ -416,7 +424,7 @@ namespace OpenSim.Region.Framework.Scenes
416 sb[1].StatValue = reportedFPS; 424 sb[1].StatValue = reportedFPS;
417 425
418 sb[2].StatID = (uint) Stats.PhysicsFPS; 426 sb[2].StatID = (uint) Stats.PhysicsFPS;
419 sb[2].StatValue = physfps * updateFactor; 427 sb[2].StatValue = physfps;
420 428
421 sb[3].StatID = (uint) Stats.AgentUpdates; 429 sb[3].StatID = (uint) Stats.AgentUpdates;
422 sb[3].StatValue = m_agentUpdates * updateFactor; 430 sb[3].StatValue = m_agentUpdates * updateFactor;
@@ -604,6 +612,7 @@ namespace OpenSim.Region.Framework.Scenes
604 612
605// LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor; 613// LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor;
606 ResetValues(); 614 ResetValues();
615 Monitor.Exit(m_statsLock);
607 } 616 }
608 } 617 }
609 618