diff options
author | Melanie | 2012-09-03 13:25:31 +0200 |
---|---|---|
committer | Melanie | 2012-09-03 13:25:31 +0200 |
commit | 7cfcca87c6f9a9b280ab5e13ba92fff1830ee203 (patch) | |
tree | df279e083490e41538d2675f632153dbcbfc4582 /OpenSim | |
parent | try to reduce potencial recursive locking (diff) | |
download | opensim-SC-7cfcca87c6f9a9b280ab5e13ba92fff1830ee203.zip opensim-SC-7cfcca87c6f9a9b280ab5e13ba92fff1830ee203.tar.gz opensim-SC-7cfcca87c6f9a9b280ab5e13ba92fff1830ee203.tar.bz2 opensim-SC-7cfcca87c6f9a9b280ab5e13ba92fff1830ee203.tar.xz |
Prevent a nullref if SimStatsReporter tries to report on a sim where psysics are
not yet initialized
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 20919a1..756b1f4 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -438,23 +438,26 @@ namespace OpenSim.Region.Framework.Scenes | |||
438 | } | 438 | } |
439 | 439 | ||
440 | // Extra statistics that aren't currently sent to clients | 440 | // Extra statistics that aren't currently sent to clients |
441 | lock (m_lastReportedExtraSimStats) | 441 | if (m_scene.PhysicsScene != null) |
442 | { | 442 | { |
443 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; | 443 | lock (m_lastReportedExtraSimStats) |
444 | |||
445 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | ||
446 | |||
447 | if (physicsStats != null) | ||
448 | { | 444 | { |
449 | foreach (KeyValuePair<string, float> tuple in physicsStats) | 445 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; |
446 | |||
447 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | ||
448 | |||
449 | if (physicsStats != null) | ||
450 | { | 450 | { |
451 | // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second | 451 | foreach (KeyValuePair<string, float> tuple in physicsStats) |
452 | // Need to change things so that stats source can indicate whether they are per second or | 452 | { |
453 | // per frame. | 453 | // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second |
454 | if (tuple.Key.EndsWith("MS")) | 454 | // Need to change things so that stats source can indicate whether they are per second or |
455 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe; | 455 | // per frame. |
456 | else | 456 | if (tuple.Key.EndsWith("MS")) |
457 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; | 457 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe; |
458 | else | ||
459 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; | ||
460 | } | ||
458 | } | 461 | } |
459 | } | 462 | } |
460 | } | 463 | } |