aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment/Scenes
diff options
context:
space:
mode:
authorTeravus Ovares2009-01-03 03:30:03 +0000
committerTeravus Ovares2009-01-03 03:30:03 +0000
commite9cef70f892bfbf4aad0e4471a958367766d849a (patch)
tree397e078977b430526a2f04041e0dfb9a5fb99156 /OpenSim/Region/Environment/Scenes
parentSplit agent updates into two messages: full update and position+camera update... (diff)
downloadopensim-SC_OLD-e9cef70f892bfbf4aad0e4471a958367766d849a.zip
opensim-SC_OLD-e9cef70f892bfbf4aad0e4471a958367766d849a.tar.gz
opensim-SC_OLD-e9cef70f892bfbf4aad0e4471a958367766d849a.tar.bz2
opensim-SC_OLD-e9cef70f892bfbf4aad0e4471a958367766d849a.tar.xz
* Updates the sim stats module. Cleans out some of the rot.
* Adds a prototype web stats module which is disabled by default. It's functional with one report right now, however, the database structure may change, so I don't recommend enabling this to keep actual stats right now. I'll let you know when it's safe. * Adds Prototype for ajaxy web content * removed a warning or two.
Diffstat (limited to 'OpenSim/Region/Environment/Scenes')
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs78
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneGraph.cs11
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs13
3 files changed, 60 insertions, 42 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 408f100..daeb186 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -69,7 +69,7 @@ namespace OpenSim.Region.Environment.Scenes
69 69
70 protected Timer m_restartWaitTimer = new Timer(); 70 protected Timer m_restartWaitTimer = new Timer();
71 71
72 protected SimStatsReporter m_statsReporter; 72 public SimStatsReporter StatsReporter;
73 73
74 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); 74 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
75 protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); 75 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
@@ -244,7 +244,7 @@ namespace OpenSim.Region.Environment.Scenes
244 /// </summary> 244 /// </summary>
245 public float SimulatorFPS 245 public float SimulatorFPS
246 { 246 {
247 get { return m_statsReporter.getLastReportedSimFPS(); } 247 get { return StatsReporter.getLastReportedSimFPS(); }
248 } 248 }
249 249
250 public int TimePhase 250 public int TimePhase
@@ -358,10 +358,10 @@ namespace OpenSim.Region.Environment.Scenes
358 358
359 m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics; 359 m_physics_enabled = !RegionInfo.RegionSettings.DisablePhysics;
360 360
361 m_statsReporter = new SimStatsReporter(this); 361 StatsReporter = new SimStatsReporter(this);
362 m_statsReporter.OnSendStatsResult += SendSimStatsPackets; 362 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
363 363
364 m_statsReporter.SetObjectCapacity(objectCapacity); 364 StatsReporter.SetObjectCapacity(objectCapacity);
365 365
366 m_simulatorVersion = simulatorVersion 366 m_simulatorVersion = simulatorVersion
367 + " (OS " + Util.GetOperatingSystemInformation() + ")" 367 + " (OS " + Util.GetOperatingSystemInformation() + ")"
@@ -814,7 +814,7 @@ namespace OpenSim.Region.Environment.Scenes
814 if (m_update_entities == 1) 814 if (m_update_entities == 1)
815 { 815 {
816 m_update_entities = 5; 816 m_update_entities = 5;
817 m_statsReporter.SetUpdateMS(6000); 817 StatsReporter.SetUpdateMS(6000);
818 } 818 }
819 } 819 }
820 else 820 else
@@ -822,7 +822,7 @@ namespace OpenSim.Region.Environment.Scenes
822 if (m_update_entities == 5) 822 if (m_update_entities == 5)
823 { 823 {
824 m_update_entities = 1; 824 m_update_entities = 1;
825 m_statsReporter.SetUpdateMS(3000); 825 StatsReporter.SetUpdateMS(3000);
826 } 826 }
827 } 827 }
828 828
@@ -891,20 +891,20 @@ namespace OpenSim.Region.Environment.Scenes
891 otherMS = System.Environment.TickCount - otherMS; 891 otherMS = System.Environment.TickCount - otherMS;
892 // if (m_frame%m_update_avatars == 0) 892 // if (m_frame%m_update_avatars == 0)
893 // UpdateInWorldTime(); 893 // UpdateInWorldTime();
894 m_statsReporter.AddPhysicsFPS(physicsFPS); 894 StatsReporter.AddPhysicsFPS(physicsFPS);
895 m_statsReporter.AddTimeDilation(m_timedilation); 895 StatsReporter.AddTimeDilation(m_timedilation);
896 m_statsReporter.AddFPS(1); 896 StatsReporter.AddFPS(1);
897 m_statsReporter.AddInPackets(0); 897 StatsReporter.AddInPackets(0);
898 m_statsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount()); 898 StatsReporter.SetRootAgents(m_sceneGraph.GetRootAgentCount());
899 m_statsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount()); 899 StatsReporter.SetChildAgents(m_sceneGraph.GetChildAgentCount());
900 m_statsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); 900 StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount());
901 m_statsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); 901 StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount());
902 frameMS = System.Environment.TickCount - frameMS; 902 frameMS = System.Environment.TickCount - frameMS;
903 m_statsReporter.addFrameMS(frameMS); 903 StatsReporter.addFrameMS(frameMS);
904 m_statsReporter.addPhysicsMS(physicsMS); 904 StatsReporter.addPhysicsMS(physicsMS);
905 m_statsReporter.addOtherMS(otherMS); 905 StatsReporter.addOtherMS(otherMS);
906 m_statsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); 906 StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount());
907 m_statsReporter.addScriptLines(m_sceneGraph.GetScriptLPS()); 907 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
908 } 908 }
909 } 909 }
910 catch (NotImplementedException) 910 catch (NotImplementedException)
@@ -2380,8 +2380,8 @@ namespace OpenSim.Region.Environment.Scenes
2380 2380
2381 client.OnObjectOwner += ObjectOwner; 2381 client.OnObjectOwner += ObjectOwner;
2382 2382
2383 if (m_statsReporter != null) 2383 if (StatsReporter != null)
2384 client.OnNetworkStatsUpdate += m_statsReporter.AddPacketsFromClientStats; 2384 client.OnNetworkStatsUpdate += StatsReporter.AddPacketsFromClientStats;
2385 2385
2386 // EventManager.TriggerOnNewClient(client); 2386 // EventManager.TriggerOnNewClient(client);
2387 } 2387 }
@@ -3027,14 +3027,14 @@ namespace OpenSim.Region.Environment.Scenes
3027 if (presence != null) 3027 if (presence != null)
3028 { 3028 {
3029 // Nothing is removed here, so down count it as such 3029 // Nothing is removed here, so down count it as such
3030 // if (presence.IsChildAgent) 3030 if (presence.IsChildAgent)
3031 // { 3031 {
3032 // m_sceneGraph.removeUserCount(false); 3032 m_sceneGraph.removeUserCount(false);
3033 // } 3033 }
3034 // else 3034 else
3035 // { 3035 {
3036 // m_sceneGraph.removeUserCount(true); 3036 m_sceneGraph.removeUserCount(true);
3037 // } 3037 }
3038 3038
3039 // Don't do this to root agents on logout, it's not nice for the viewer 3039 // Don't do this to root agents on logout, it's not nice for the viewer
3040 if (presence.IsChildAgent) 3040 if (presence.IsChildAgent)
@@ -3322,9 +3322,9 @@ namespace OpenSim.Region.Environment.Scenes
3322 if (RegionInfo.ObjectCapacity != 0) 3322 if (RegionInfo.ObjectCapacity != 0)
3323 objects = RegionInfo.ObjectCapacity; 3323 objects = RegionInfo.ObjectCapacity;
3324 3324
3325 if (m_statsReporter != null) 3325 if (StatsReporter != null)
3326 { 3326 {
3327 m_statsReporter.SetObjectCapacity(objects); 3327 StatsReporter.SetObjectCapacity(objects);
3328 } 3328 }
3329 objectCapacity = objects; 3329 objectCapacity = objects;
3330 } 3330 }
@@ -3430,25 +3430,25 @@ namespace OpenSim.Region.Environment.Scenes
3430 3430
3431 public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes) 3431 public void AddPacketStats(int inPackets, int outPackets, int unAckedBytes)
3432 { 3432 {
3433 m_statsReporter.AddInPackets(inPackets); 3433 StatsReporter.AddInPackets(inPackets);
3434 m_statsReporter.AddOutPackets(outPackets); 3434 StatsReporter.AddOutPackets(outPackets);
3435 m_statsReporter.AddunAckedBytes(unAckedBytes); 3435 StatsReporter.AddunAckedBytes(unAckedBytes);
3436 } 3436 }
3437 3437
3438 public void AddAgentTime(int ms) 3438 public void AddAgentTime(int ms)
3439 { 3439 {
3440 m_statsReporter.addFrameMS(ms); 3440 StatsReporter.addFrameMS(ms);
3441 m_statsReporter.addAgentMS(ms); 3441 StatsReporter.addAgentMS(ms);
3442 } 3442 }
3443 3443
3444 public void AddAgentUpdates(int count) 3444 public void AddAgentUpdates(int count)
3445 { 3445 {
3446 m_statsReporter.AddAgentUpdates(count); 3446 StatsReporter.AddAgentUpdates(count);
3447 } 3447 }
3448 3448
3449 public void AddPendingDownloads(int count) 3449 public void AddPendingDownloads(int count)
3450 { 3450 {
3451 m_statsReporter.addPendingDownload(count); 3451 StatsReporter.addPendingDownload(count);
3452 } 3452 }
3453 3453
3454 #endregion 3454 #endregion
diff --git a/OpenSim/Region/Environment/Scenes/SceneGraph.cs b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
index d998dbb..3ffa5c3 100644
--- a/OpenSim/Region/Environment/Scenes/SceneGraph.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneGraph.cs
@@ -306,8 +306,19 @@ namespace OpenSim.Region.Environment.Scenes
306 if (!resultOfObjectLinked) 306 if (!resultOfObjectLinked)
307 { 307 {
308 m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count; 308 m_numPrim -= ((SceneObjectGroup) Entities[uuid]).Children.Count;
309
310 if ((((SceneObjectGroup)Entities[uuid]).RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
311 {
312 RemovePhysicalPrim(((SceneObjectGroup)Entities[uuid]).Children.Count);
313 }
309 } 314 }
315
316
317
310 Entities.Remove(uuid); 318 Entities.Remove(uuid);
319 //SceneObjectGroup part;
320 //((part.RootPart.Flags & PrimFlags.Physics) == PrimFlags.Physics)
321
311 322
312 return true; 323 return true;
313 } 324 }
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index c614f78..e2afa5a 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -26,6 +26,7 @@
26 */ 26 */
27 27
28using System; 28using System;
29//using System.Collections.Generic;
29using System.Timers; 30using System.Timers;
30using OpenMetaverse.Packets; 31using OpenMetaverse.Packets;
31using OpenSim.Framework; 32using OpenSim.Framework;
@@ -189,7 +190,7 @@ namespace OpenSim.Region.Environment.Scenes
189 } 190 }
190 191
191 sb[0].StatID = (uint) Stats.TimeDilation; 192 sb[0].StatID = (uint) Stats.TimeDilation;
192 sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); 193 sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
193 194
194 sb[1].StatID = (uint) Stats.SimFPS; 195 sb[1].StatID = (uint) Stats.SimFPS;
195 sb[1].StatValue = simfps/statsUpdateFactor; 196 sb[1].StatValue = simfps/statsUpdateFactor;
@@ -253,7 +254,7 @@ namespace OpenSim.Region.Environment.Scenes
253 254
254 SimStats simStats 255 SimStats simStats
255 = new SimStats( 256 = new SimStats(
256 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb); 257 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID);
257 258
258 handlerSendStatResult = OnSendStatsResult; 259 handlerSendStatResult = OnSendStatsResult;
259 if (handlerSendStatResult != null) 260 if (handlerSendStatResult != null)
@@ -309,7 +310,11 @@ namespace OpenSim.Region.Environment.Scenes
309 310
310 public void SetChildAgents(int childAgents) 311 public void SetChildAgents(int childAgents)
311 { 312 {
312 m_childAgents = childAgents; 313 m_childAgents = (childAgents > 0) ? childAgents : 0;
314 if (childAgents < 0)
315 {
316 //List<ScenePresence> avs= m_scene.GetScenePresences();
317 }
313 } 318 }
314 319
315 public void SetObjects(int objects) 320 public void SetObjects(int objects)
@@ -350,6 +355,7 @@ namespace OpenSim.Region.Environment.Scenes
350 public void AddunAckedBytes(int numBytes) 355 public void AddunAckedBytes(int numBytes)
351 { 356 {
352 m_unAckedBytes += numBytes; 357 m_unAckedBytes += numBytes;
358 if (m_unAckedBytes < 0) m_unAckedBytes = 0;
353 } 359 }
354 360
355 public void addFrameMS(int ms) 361 public void addFrameMS(int ms)
@@ -383,6 +389,7 @@ namespace OpenSim.Region.Environment.Scenes
383 public void addPendingDownload(int count) 389 public void addPendingDownload(int count)
384 { 390 {
385 m_pendingDownloads += count; 391 m_pendingDownloads += count;
392 if (m_pendingDownloads < 0) m_pendingDownloads = 0;
386 //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads); 393 //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads);
387 } 394 }
388 395