aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
diff options
context:
space:
mode:
authorUbitUmarov2012-07-17 03:45:16 +0100
committerUbitUmarov2012-07-17 03:45:16 +0100
commitf004db65726fc2e00fe14d9c343ef46136f350f9 (patch)
treea38f17b0273b96070300d462879181e3073276b2 /OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
parentMerge branch 'avination' into ubitwork (diff)
downloadopensim-SC_OLD-f004db65726fc2e00fe14d9c343ef46136f350f9.zip
opensim-SC_OLD-f004db65726fc2e00fe14d9c343ef46136f350f9.tar.gz
opensim-SC_OLD-f004db65726fc2e00fe14d9c343ef46136f350f9.tar.bz2
opensim-SC_OLD-f004db65726fc2e00fe14d9c343ef46136f350f9.tar.xz
fix our stats ( old schema )
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs67
1 files changed, 40 insertions, 27 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 18e6ece..d6ff5a2 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
164 164
165 // saved last reported value so there is something available for llGetRegionFPS 165 // saved last reported value so there is something available for llGetRegionFPS
166 private float lastReportedSimFPS; 166 private float lastReportedSimFPS;
167 private float[] lastReportedSimStats = new float[22]; 167 private float[] lastReportedSimStats = new float[23];
168 private float m_pfps; 168 private float m_pfps;
169 169
170 /// <summary> 170 /// <summary>
@@ -178,12 +178,13 @@ namespace OpenSim.Region.Framework.Scenes
178 private int m_objectUpdates; 178 private int m_objectUpdates;
179 179
180 private int m_frameMS; 180 private int m_frameMS;
181 private int m_spareMS; 181
182 private int m_netMS; 182 private int m_netMS;
183 private int m_agentMS; 183 private int m_agentMS;
184 private int m_physicsMS; 184 private int m_physicsMS;
185 private int m_imageMS; 185 private int m_imageMS;
186 private int m_otherMS; 186 private int m_otherMS;
187 private int m_sleeptimeMS;
187 188
188//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. 189//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
189//Ckrinke private int m_scriptMS = 0; 190//Ckrinke private int m_scriptMS = 0;
@@ -260,7 +261,7 @@ namespace OpenSim.Region.Framework.Scenes
260 261
261 private void statsHeartBeat(object sender, EventArgs e) 262 private void statsHeartBeat(object sender, EventArgs e)
262 { 263 {
263 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22]; 264 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
264 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 265 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
265 266
266 // Know what's not thread safe in Mono... modifying timers. 267 // Know what's not thread safe in Mono... modifying timers.
@@ -298,6 +299,8 @@ namespace OpenSim.Region.Framework.Scenes
298 physfps = 0; 299 physfps = 0;
299 300
300#endregion 301#endregion
302 float factor = 1 / m_statsUpdateFactor;
303
301 if (reportedFPS <= 0) 304 if (reportedFPS <= 0)
302 reportedFPS = 1; 305 reportedFPS = 1;
303 306
@@ -308,9 +311,22 @@ namespace OpenSim.Region.Framework.Scenes
308 float targetframetime = 1100.0f / (float)m_nominalReportedFps; 311 float targetframetime = 1100.0f / (float)m_nominalReportedFps;
309 312
310 float sparetime; 313 float sparetime;
314 float sleeptime;
315
311 if (TotalFrameTime > targetframetime) 316 if (TotalFrameTime > targetframetime)
312 { 317 {
313 sparetime = 0; 318 sparetime = 0;
319 sleeptime = 0;
320 }
321 else
322 {
323 sparetime = m_frameMS - m_physicsMS - m_agentMS;
324 sparetime *= perframe;
325 if (sparetime < 0)
326 sparetime = 0;
327 else if (sparetime > TotalFrameTime)
328 sparetime = TotalFrameTime;
329 sleeptime = m_sleeptimeMS * perframe;
314 } 330 }
315 331
316 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); 332 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
@@ -327,19 +343,11 @@ namespace OpenSim.Region.Framework.Scenes
327 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; 343 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
328 // m_imageMS m_netMS are not included in m_frameMS 344 // m_imageMS m_netMS are not included in m_frameMS
329 345
330 m_otherMS = m_frameMS - m_physicsMS - m_agentMS; 346 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS;
331 if (m_otherMS < 0) 347 if (m_otherMS < 0)
332 m_otherMS = 0; 348 m_otherMS = 0;
333 349
334 uint thisFrame = m_scene.Frame; 350 for (int i = 0; i < 23; i++)
335 float framesUpdated = (float)(thisFrame - m_lastUpdateFrame) * m_reportedFpsCorrectionFactor;
336 m_lastUpdateFrame = thisFrame;
337
338 // Avoid div-by-zero if somehow we've not updated any frames.
339 if (framesUpdated == 0)
340 framesUpdated = 1;
341
342 for (int i = 0; i < 22; i++)
343 { 351 {
344 sb[i] = new SimStatsPacket.StatBlock(); 352 sb[i] = new SimStatsPacket.StatBlock();
345 } 353 }
@@ -369,19 +377,19 @@ namespace OpenSim.Region.Framework.Scenes
369 sb[7].StatValue = m_activePrim; 377 sb[7].StatValue = m_activePrim;
370 378
371 sb[8].StatID = (uint)Stats.FrameMS; 379 sb[8].StatID = (uint)Stats.FrameMS;
372 sb[8].StatValue = m_frameMS / framesUpdated; 380 sb[8].StatValue = TotalFrameTime;
373 381
374 sb[9].StatID = (uint)Stats.NetMS; 382 sb[9].StatID = (uint)Stats.NetMS;
375 sb[9].StatValue = m_netMS / framesUpdated; 383 sb[9].StatValue = m_netMS * perframe;
376 384
377 sb[10].StatID = (uint)Stats.PhysicsMS; 385 sb[10].StatID = (uint)Stats.PhysicsMS;
378 sb[10].StatValue = m_physicsMS / framesUpdated; 386 sb[10].StatValue = m_physicsMS * perframe;
379 387
380 sb[11].StatID = (uint)Stats.ImageMS ; 388 sb[11].StatID = (uint)Stats.ImageMS ;
381 sb[11].StatValue = m_imageMS / framesUpdated; 389 sb[11].StatValue = m_imageMS * perframe;
382 390
383 sb[12].StatID = (uint)Stats.OtherMS; 391 sb[12].StatID = (uint)Stats.OtherMS;
384 sb[12].StatValue = m_otherMS / framesUpdated; 392 sb[12].StatValue = m_otherMS * perframe;
385 393
386 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 394 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
387 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); 395 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
@@ -393,7 +401,7 @@ namespace OpenSim.Region.Framework.Scenes
393 sb[15].StatValue = m_unAckedBytes; 401 sb[15].StatValue = m_unAckedBytes;
394 402
395 sb[16].StatID = (uint)Stats.AgentMS; 403 sb[16].StatID = (uint)Stats.AgentMS;
396 sb[16].StatValue = m_agentMS / framesUpdated; 404 sb[16].StatValue = m_agentMS * perframe;
397 405
398 sb[17].StatID = (uint)Stats.PendingDownloads; 406 sb[17].StatID = (uint)Stats.PendingDownloads;
399 sb[17].StatValue = m_pendingDownloads; 407 sb[17].StatValue = m_pendingDownloads;
@@ -408,7 +416,10 @@ namespace OpenSim.Region.Framework.Scenes
408 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor; 416 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
409 417
410 sb[21].StatID = (uint)Stats.SimSpareMs; 418 sb[21].StatID = (uint)Stats.SimSpareMs;
411 sb[21].StatValue = m_spareMS / framesUpdated; 419 sb[21].StatValue = sparetime;
420
421 sb[22].StatID = (uint)Stats.SimSleepMs;
422 sb[22].StatValue = sleeptime;
412 423
413 for (int i = 0; i < 22; i++) 424 for (int i = 0; i < 22; i++)
414 { 425 {
@@ -441,13 +452,14 @@ namespace OpenSim.Region.Framework.Scenes
441 // Need to change things so that stats source can indicate whether they are per second or 452 // Need to change things so that stats source can indicate whether they are per second or
442 // per frame. 453 // per frame.
443 if (tuple.Key.EndsWith("MS")) 454 if (tuple.Key.EndsWith("MS"))
444 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / framesUpdated; 455 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe;
445 else 456 else
446 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; 457 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
447 } 458 }
448 } 459 }
449 } 460 }
450 461
462// LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor;
451 ResetValues(); 463 ResetValues();
452 } 464 }
453 } 465 }
@@ -470,7 +482,8 @@ namespace OpenSim.Region.Framework.Scenes
470 m_physicsMS = 0; 482 m_physicsMS = 0;
471 m_imageMS = 0; 483 m_imageMS = 0;
472 m_otherMS = 0; 484 m_otherMS = 0;
473 m_spareMS = 0; 485// m_spareMS = 0;
486 m_sleeptimeMS = 0;
474 487
475//Ckrinke This variable is not used, so comment to remove compiler warning until it is used. 488//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
476//Ckrinke m_scriptMS = 0; 489//Ckrinke m_scriptMS = 0;
@@ -549,11 +562,6 @@ namespace OpenSim.Region.Framework.Scenes
549 m_frameMS += ms; 562 m_frameMS += ms;
550 } 563 }
551 564
552 public void AddSpareMS(int ms)
553 {
554 m_spareMS += ms;
555 }
556
557 public void addNetMS(int ms) 565 public void addNetMS(int ms)
558 { 566 {
559 m_netMS += ms; 567 m_netMS += ms;
@@ -579,6 +587,11 @@ namespace OpenSim.Region.Framework.Scenes
579 m_otherMS += ms; 587 m_otherMS += ms;
580 } 588 }
581 589
590 public void addSleepMS(int ms)
591 {
592 m_sleeptimeMS += ms;
593 }
594
582 public void AddPendingDownloads(int count) 595 public void AddPendingDownloads(int count)
583 { 596 {
584 m_pendingDownloads += count; 597 m_pendingDownloads += count;