aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares2009-01-06 00:07:24 +0000
committerTeravus Ovares2009-01-06 00:07:24 +0000
commit0d1b8675004a37c1a5590a6825b5204b08e285e6 (patch)
tree645d251a771f4581ba16398324f8a4059918e9d1 /OpenSim
parentUse correct name for friendship offer. Fixes Mantis #2959. (diff)
downloadopensim-SC_OLD-0d1b8675004a37c1a5590a6825b5204b08e285e6.zip
opensim-SC_OLD-0d1b8675004a37c1a5590a6825b5204b08e285e6.tar.gz
opensim-SC_OLD-0d1b8675004a37c1a5590a6825b5204b08e285e6.tar.bz2
opensim-SC_OLD-0d1b8675004a37c1a5590a6825b5204b08e285e6.tar.xz
* Added a way for the sim stats reporter to say to the scene that the stats are illogical.
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs1
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneGraph.cs20
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs29
3 files changed, 46 insertions, 4 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index d0013ba..06e8a54 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -360,6 +360,7 @@ namespace OpenSim.Region.Environment.Scenes
360 360
361 StatsReporter = new SimStatsReporter(this); 361 StatsReporter = new SimStatsReporter(this);
362 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 362 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
363 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
363 364
364 StatsReporter.SetObjectCapacity(objectCapacity); 365 StatsReporter.SetObjectCapacity(objectCapacity);
365 366
diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
index 3ffa5c3..8476344 100644
--- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
@@ -694,6 +694,24 @@ namespace OpenSim.Region.Environment.Scenes
694 } 694 }
695 } 695 }
696 696
697 public void RecalculateStats()
698 {
699 List<ScenePresence> SPList = GetScenePresences();
700 int rootcount = 0;
701 int childcount = 0;
702
703 foreach (ScenePresence user in SPList)
704 {
705 if (user.IsChildAgent)
706 childcount++;
707 else
708 rootcount++;
709 }
710 m_numRootAgents = rootcount;
711 m_numChildAgents = childcount;
712
713 }
714
697 public int GetChildAgentCount() 715 public int GetChildAgentCount()
698 { 716 {
699 // some network situations come in where child agents get closed twice. 717 // some network situations come in where child agents get closed twice.
@@ -1748,5 +1766,7 @@ namespace OpenSim.Region.Environment.Scenes
1748 } 1766 }
1749 1767
1750 #endregion 1768 #endregion
1769
1770
1751 } 1771 }
1752} 1772}
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index e2afa5a..efda140 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -39,10 +39,16 @@ namespace OpenSim.Region.Environment.Scenes
39 { 39 {
40 public delegate void SendStatResult(SimStats stats); 40 public delegate void SendStatResult(SimStats stats);
41 41
42 public delegate void YourStatsAreWrong();
43
42 public event SendStatResult OnSendStatsResult; 44 public event SendStatResult OnSendStatsResult;
43 45
46 public event YourStatsAreWrong OnStatsIncorrect;
47
44 private SendStatResult handlerSendStatResult = null; 48 private SendStatResult handlerSendStatResult = null;
45 49
50 private YourStatsAreWrong handlerStatsIncorrect = null;
51
46 private enum Stats : uint 52 private enum Stats : uint
47 { 53 {
48 TimeDilation = 0, 54 TimeDilation = 0,
@@ -306,15 +312,30 @@ namespace OpenSim.Region.Environment.Scenes
306 public void SetRootAgents(int rootAgents) 312 public void SetRootAgents(int rootAgents)
307 { 313 {
308 m_rootAgents = rootAgents; 314 m_rootAgents = rootAgents;
315 CheckStatSanity();
316
309 } 317 }
310 318
311 public void SetChildAgents(int childAgents) 319 internal void CheckStatSanity()
312 { 320 {
313 m_childAgents = (childAgents > 0) ? childAgents : 0; 321 if (m_rootAgents < 0 || m_childAgents < 0)
314 if (childAgents < 0)
315 { 322 {
316 //List<ScenePresence> avs= m_scene.GetScenePresences(); 323 handlerStatsIncorrect = OnStatsIncorrect;
324 if (handlerStatsIncorrect != null)
325 {
326 handlerStatsIncorrect();
327 }
317 } 328 }
329 if (m_rootAgents == 0 && m_childAgents == 0)
330 {
331 m_unAckedBytes = 0;
332 }
333 }
334
335 public void SetChildAgents(int childAgents)
336 {
337 m_childAgents = childAgents;
338 CheckStatSanity();
318 } 339 }
319 340
320 public void SetObjects(int objects) 341 public void SetObjects(int objects)