aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Environment
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Environment')
-rw-r--r--OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs4
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs44
3 files changed, 23 insertions, 27 deletions
diff --git a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
index a236ccd..b59b013 100644
--- a/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
+++ b/OpenSim/Region/Environment/Modules/World/NPC/NPCAvatar.cs
@@ -706,7 +706,7 @@ namespace OpenSim.Region.Environment.Modules.World.NPC
706 { 706 {
707 } 707 }
708 708
709 public void SendSimStats(Packet pack) 709 public void SendSimStats(SimStats stats)
710 { 710 {
711 } 711 }
712 712
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index bf1dbcd..da6da1e 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -837,14 +837,14 @@ namespace OpenSim.Region.Environment.Scenes
837 } 837 }
838 } 838 }
839 839
840 private void SendSimStatsPackets(SimStatsPacket pack) 840 private void SendSimStatsPackets(SimStats stats)
841 { 841 {
842 List<ScenePresence> StatSendAgents = GetScenePresences(); 842 List<ScenePresence> StatSendAgents = GetScenePresences();
843 foreach (ScenePresence agent in StatSendAgents) 843 foreach (ScenePresence agent in StatSendAgents)
844 { 844 {
845 if (!agent.IsChildAgent) 845 if (!agent.IsChildAgent)
846 { 846 {
847 agent.ControllingClient.SendSimStats(pack); 847 agent.ControllingClient.SendSimStats(stats);
848 } 848 }
849 } 849 }
850 } 850 }
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
index 5f0f316..4c9c59d 100644
--- a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Environment.Scenes
36{ 36{
37 public class SimStatsReporter 37 public class SimStatsReporter
38 { 38 {
39 public delegate void SendStatResult(SimStatsPacket pack); 39 public delegate void SendStatResult(SimStats stats);
40 40
41 public event SendStatResult OnSendStatsResult; 41 public event SendStatResult OnSendStatsResult;
42 42
@@ -100,12 +100,6 @@ namespace OpenSim.Region.Environment.Scenes
100 100
101 private int objectCapacity = 45000; 101 private int objectCapacity = 45000;
102 102
103
104 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
105 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
106 SimStatsPacket statpack = (SimStatsPacket)PacketPool.Instance.GetPacket(PacketType.SimStats);
107
108
109 private Scene m_scene; 103 private Scene m_scene;
110 104
111 private RegionInfo ReportingRegion; 105 private RegionInfo ReportingRegion;
@@ -118,10 +112,7 @@ namespace OpenSim.Region.Environment.Scenes
118 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000); 112 statsUpdateFactor = (float)(statsUpdatesEveryMS / 1000);
119 m_scene = scene; 113 m_scene = scene;
120 ReportingRegion = scene.RegionInfo; 114 ReportingRegion = scene.RegionInfo;
121 for (int i = 0; i<21;i++) 115
122 {
123 sb[i] = new SimStatsPacket.StatBlock();
124 }
125 m_report.AutoReset = true; 116 m_report.AutoReset = true;
126 m_report.Interval = statsUpdatesEveryMS; 117 m_report.Interval = statsUpdatesEveryMS;
127 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat); 118 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
@@ -140,26 +131,24 @@ namespace OpenSim.Region.Environment.Scenes
140 131
141 private void statsHeartBeat(object sender, EventArgs e) 132 private void statsHeartBeat(object sender, EventArgs e)
142 { 133 {
134 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21];
135 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
136
143 // Know what's not thread safe in Mono... modifying timers. 137 // Know what's not thread safe in Mono... modifying timers.
144 // System.Console.WriteLine("Firing Stats Heart Beat"); 138 // System.Console.WriteLine("Firing Stats Heart Beat");
145 lock (m_report) 139 lock (m_report)
146 { 140 {
147 // Packet is already initialized and ready for data insert 141 uint regionFlags = 0;
148 142
149
150 statpack.Region = rb;
151 statpack.Region.RegionX = ReportingRegion.RegionLocX;
152 statpack.Region.RegionY = ReportingRegion.RegionLocY;
153 try 143 try
154 { 144 {
155 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>(); 145 IEstateModule estateModule = m_scene.RequestModuleInterface<IEstateModule>();
156 statpack.Region.RegionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0; 146 regionFlags = estateModule != null ? estateModule.GetRegionFlags() : (uint) 0;
157 } 147 }
158 catch (Exception) 148 catch (Exception)
159 { 149 {
160 statpack.Region.RegionFlags = (uint) 0; 150 // leave region flags at 0
161 } 151 }
162 statpack.Region.ObjectCapacity = (uint) objectCapacity;
163 152
164#region various statistic googly moogly 153#region various statistic googly moogly
165 154
@@ -182,7 +171,7 @@ namespace OpenSim.Region.Environment.Scenes
182 physfps = 0; 171 physfps = 0;
183 172
184#endregion 173#endregion
185 174
186 //Our time dilation is 0.91 when we're running a full speed, 175 //Our time dilation is 0.91 when we're running a full speed,
187 // therefore to make sure we get an appropriate range, 176 // therefore to make sure we get an appropriate range,
188 // we have to factor in our error. (0.10f * statsUpdateFactor) 177 // we have to factor in our error. (0.10f * statsUpdateFactor)
@@ -190,6 +179,11 @@ namespace OpenSim.Region.Environment.Scenes
190 // / 10 divides the value by the number of times the sim heartbeat runs (10fps) 179 // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
191 // Then we divide the whole amount by the amount of seconds pass in between stats updates. 180 // Then we divide the whole amount by the amount of seconds pass in between stats updates.
192 181
182 for (int i = 0; i<21;i++)
183 {
184 sb[i] = new SimStatsPacket.StatBlock();
185 }
186
193 sb[0].StatID = (uint) Stats.TimeDilation; 187 sb[0].StatID = (uint) Stats.TimeDilation;
194 sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); 188 sb[0].StatValue = m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor));
195 189
@@ -252,13 +246,15 @@ namespace OpenSim.Region.Environment.Scenes
252 246
253 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; 247 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
254 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; 248 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
255 249
256 statpack.Stat = sb; 250 SimStats simStats
251 = new SimStats(
252 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)objectCapacity, rb, sb);
257 253
258 handlerSendStatResult = OnSendStatsResult; 254 handlerSendStatResult = OnSendStatsResult;
259 if (handlerSendStatResult != null) 255 if (handlerSendStatResult != null)
260 { 256 {
261 handlerSendStatResult(statpack); 257 handlerSendStatResult(simStats);
262 } 258 }
263 resetvalues(); 259 resetvalues();
264 } 260 }