aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SimStatsReporter.cs')
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs26
1 files changed, 20 insertions, 6 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index ee288b3..f92f440 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -82,6 +82,7 @@ namespace OpenSim.Region.Framework.Scenes
82 private int m_fps = 0; 82 private int m_fps = 0;
83 // saved last reported value so there is something available for llGetRegionFPS 83 // saved last reported value so there is something available for llGetRegionFPS
84 private float lastReportedSimFPS = 0; 84 private float lastReportedSimFPS = 0;
85 private float[] lastReportedSimStats = new float[21];
85 private float m_pfps = 0; 86 private float m_pfps = 0;
86 private int m_agentUpdates = 0; 87 private int m_agentUpdates = 0;
87 88
@@ -192,6 +193,9 @@ namespace OpenSim.Region.Framework.Scenes
192 // / 10 divides the value by the number of times the sim heartbeat runs (10fps) 193 // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
193 // Then we divide the whole amount by the amount of seconds pass in between stats updates. 194 // Then we divide the whole amount by the amount of seconds pass in between stats updates.
194 195
196 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
197 // values to X-per-second values.
198
195 for (int i = 0; i<21;i++) 199 for (int i = 0; i<21;i++)
196 { 200 {
197 sb[i] = new SimStatsPacket.StatBlock(); 201 sb[i] = new SimStatsPacket.StatBlock();
@@ -236,8 +240,8 @@ namespace OpenSim.Region.Framework.Scenes
236 sb[12].StatID = (uint)Stats.OtherMS; 240 sb[12].StatID = (uint)Stats.OtherMS;
237 sb[12].StatValue = m_otherMS / statsUpdateFactor; 241 sb[12].StatValue = m_otherMS / statsUpdateFactor;
238 242
239 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 243 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
240 sb[13].StatValue = (m_inPacketsPerSecond); 244 sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor);
241 245
242 sb[14].StatID = (uint)Stats.OutPacketsPerSecond; 246 sb[14].StatID = (uint)Stats.OutPacketsPerSecond;
243 sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor); 247 sb[14].StatValue = (m_outPacketsPerSecond / statsUpdateFactor);
@@ -259,6 +263,11 @@ namespace OpenSim.Region.Framework.Scenes
259 263
260 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; 264 sb[20].StatID = (uint)Stats.ScriptLinesPerSecond;
261 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; 265 sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor;
266
267 for (int i = 0; i < 21; i++)
268 {
269 lastReportedSimStats[i] = sb[i].StatValue;
270 }
262 271
263 SimStats simStats 272 SimStats simStats
264 = new SimStats( 273 = new SimStats(
@@ -279,8 +288,8 @@ namespace OpenSim.Region.Framework.Scenes
279 m_fps = 0; 288 m_fps = 0;
280 m_pfps = 0; 289 m_pfps = 0;
281 m_agentUpdates = 0; 290 m_agentUpdates = 0;
282 m_inPacketsPerSecond = 0; 291 //m_inPacketsPerSecond = 0;
283 m_outPacketsPerSecond = 0; 292 //m_outPacketsPerSecond = 0;
284 m_unAckedBytes = 0; 293 m_unAckedBytes = 0;
285 m_scriptLinesPerSecond = 0; 294 m_scriptLinesPerSecond = 0;
286 295
@@ -367,12 +376,12 @@ namespace OpenSim.Region.Framework.Scenes
367 376
368 public void AddInPackets(int numPackets) 377 public void AddInPackets(int numPackets)
369 { 378 {
370 m_inPacketsPerSecond += numPackets; 379 m_inPacketsPerSecond = numPackets;
371 } 380 }
372 381
373 public void AddOutPackets(int numPackets) 382 public void AddOutPackets(int numPackets)
374 { 383 {
375 m_outPacketsPerSecond += numPackets; 384 m_outPacketsPerSecond = numPackets;
376 } 385 }
377 386
378 public void AddunAckedBytes(int numBytes) 387 public void AddunAckedBytes(int numBytes)
@@ -438,6 +447,11 @@ namespace OpenSim.Region.Framework.Scenes
438 { 447 {
439 return lastReportedSimFPS; 448 return lastReportedSimFPS;
440 } 449 }
450
451 public float[] getLastReportedSimStats()
452 {
453 return lastReportedSimStats;
454 }
441 455
442 public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) 456 public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes)
443 { 457 {