aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
diff options
context:
space:
mode:
authorUbitUmarov2015-09-01 14:54:35 +0100
committerUbitUmarov2015-09-01 14:54:35 +0100
commit371c9dd2af01a2e7422ec901ee1f80757284a78c (patch)
tree058d2a513cacb12efcce0c0df0ae14ad135dbfe2 /OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
parentremove lixo (diff)
parentdont change camera on crossings (diff)
downloadopensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.zip
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.gz
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.bz2
opensim-SC-371c9dd2af01a2e7422ec901ee1f80757284a78c.tar.xz
bad merge?
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SimStatsReporter.cs142
1 files changed, 109 insertions, 33 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 2174e51..52e3ff1 100755
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -184,7 +184,11 @@ namespace OpenSim.Region.Framework.Scenes
184 184
185 // saved last reported value so there is something available for llGetRegionFPS 185 // saved last reported value so there is something available for llGetRegionFPS
186 private float lastReportedSimFPS; 186 private float lastReportedSimFPS;
187<<<<<<< HEAD
187 private float[] lastReportedSimStats = new float[m_statisticArraySize]; 188 private float[] lastReportedSimStats = new float[m_statisticArraySize];
189=======
190 private float[] lastReportedSimStats = new float[23];
191>>>>>>> avn/ubitvar
188 private float m_pfps; 192 private float m_pfps;
189 193
190 /// <summary> 194 /// <summary>
@@ -198,13 +202,20 @@ namespace OpenSim.Region.Framework.Scenes
198 private int m_objectUpdates; 202 private int m_objectUpdates;
199 203
200 private int m_frameMS; 204 private int m_frameMS;
201 private int m_spareMS; 205
202 private int m_netMS; 206 private int m_netMS;
203 private int m_agentMS; 207 private int m_agentMS;
204 private int m_physicsMS; 208 private int m_physicsMS;
205 private int m_imageMS; 209 private int m_imageMS;
206 private int m_otherMS; 210 private int m_otherMS;
211<<<<<<< HEAD
207 private int m_scriptMS; 212 private int m_scriptMS;
213=======
214 private int m_sleeptimeMS;
215
216//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
217//Ckrinke private int m_scriptMS = 0;
218>>>>>>> avn/ubitvar
208 219
209 private int m_rootAgents; 220 private int m_rootAgents;
210 private int m_childAgents; 221 private int m_childAgents;
@@ -355,11 +366,15 @@ namespace OpenSim.Region.Framework.Scenes
355 if (!m_scene.Active) 366 if (!m_scene.Active)
356 return; 367 return;
357 368
369<<<<<<< HEAD
358 // Create arrays to hold the statistics for this current scene, 370 // Create arrays to hold the statistics for this current scene,
359 // these will be passed to the SimExtraStatsCollector, they are also 371 // these will be passed to the SimExtraStatsCollector, they are also
360 // sent to the SimStats class 372 // sent to the SimStats class
361 SimStatsPacket.StatBlock[] sb = new 373 SimStatsPacket.StatBlock[] sb = new
362 SimStatsPacket.StatBlock[m_statisticArraySize]; 374 SimStatsPacket.StatBlock[m_statisticArraySize];
375=======
376 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
377>>>>>>> avn/ubitvar
363 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 378 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
364 379
365 // Know what's not thread safe in Mono... modifying timers. 380 // Know what's not thread safe in Mono... modifying timers.
@@ -404,6 +419,35 @@ namespace OpenSim.Region.Framework.Scenes
404 physfps = 0; 419 physfps = 0;
405 420
406#endregion 421#endregion
422 float factor = 1 / m_statsUpdateFactor;
423
424 if (reportedFPS <= 0)
425 reportedFPS = 1;
426
427 float perframe = 1.0f / (float)reportedFPS;
428
429 float TotalFrameTime = m_frameMS * perframe;
430
431 float targetframetime = 1100.0f / (float)m_nominalReportedFps;
432
433 float sparetime;
434 float sleeptime;
435
436 if (TotalFrameTime > targetframetime)
437 {
438 sparetime = 0;
439 sleeptime = 0;
440 }
441 else
442 {
443 sparetime = m_frameMS - m_physicsMS - m_agentMS;
444 sparetime *= perframe;
445 if (sparetime < 0)
446 sparetime = 0;
447 else if (sparetime > TotalFrameTime)
448 sparetime = TotalFrameTime;
449 sleeptime = m_sleeptimeMS * perframe;
450 }
407 451
408 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); 452 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
409 m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); 453 m_childAgents = m_scene.SceneGraph.GetChildAgentCount();
@@ -417,16 +461,11 @@ namespace OpenSim.Region.Framework.Scenes
417 // so that stat numbers are always consistent. 461 // so that stat numbers are always consistent.
418 CheckStatSanity(); 462 CheckStatSanity();
419 463
420 //Our time dilation is 0.91 when we're running a full speed, 464 // other MS is actually simulation time
421 // therefore to make sure we get an appropriate range, 465 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
422 // we have to factor in our error. (0.10f * statsUpdateFactor) 466 // m_imageMS m_netMS are not included in m_frameMS
423 // multiplies the fix for the error times the amount of times it'll occur a second
424 // / 10 divides the value by the number of times the sim heartbeat runs (10fps)
425 // Then we divide the whole amount by the amount of seconds pass in between stats updates.
426
427 // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change
428 // values to X-per-second values.
429 467
468<<<<<<< HEAD
430 uint thisFrame = m_scene.Frame; 469 uint thisFrame = m_scene.Frame;
431 uint numFrames = thisFrame - m_lastUpdateFrame; 470 uint numFrames = thisFrame - m_lastUpdateFrame;
432 float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor; 471 float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor;
@@ -437,6 +476,13 @@ namespace OpenSim.Region.Framework.Scenes
437 framesUpdated = 1; 476 framesUpdated = 1;
438 477
439 for (int i = 0; i < m_statisticArraySize; i++) 478 for (int i = 0; i < m_statisticArraySize; i++)
479=======
480 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS;
481 if (m_otherMS < 0)
482 m_otherMS = 0;
483
484 for (int i = 0; i < 23; i++)
485>>>>>>> avn/ubitvar
440 { 486 {
441 sb[i] = new SimStatsPacket.StatBlock(); 487 sb[i] = new SimStatsPacket.StatBlock();
442 } 488 }
@@ -501,6 +547,7 @@ namespace OpenSim.Region.Framework.Scenes
501 // ORIGINAL code commented out until we have time to add our own 547 // ORIGINAL code commented out until we have time to add our own
502 // statistics to the statistics window 548 // statistics to the statistics window
503 sb[8].StatID = (uint)Stats.FrameMS; 549 sb[8].StatID = (uint)Stats.FrameMS;
550<<<<<<< HEAD
504 //sb[8].StatValue = m_frameMS / framesUpdated; 551 //sb[8].StatValue = m_frameMS / framesUpdated;
505 sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; 552 sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored;
506 553
@@ -511,13 +558,26 @@ namespace OpenSim.Region.Framework.Scenes
511 sb[10].StatID = (uint)Stats.PhysicsMS; 558 sb[10].StatID = (uint)Stats.PhysicsMS;
512 //sb[10].StatValue = m_physicsMS / framesUpdated; 559 //sb[10].StatValue = m_physicsMS / framesUpdated;
513 sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; 560 sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored;
561=======
562 sb[8].StatValue = TotalFrameTime;
563
564 sb[9].StatID = (uint)Stats.NetMS;
565 sb[9].StatValue = m_netMS * perframe;
566
567 sb[10].StatID = (uint)Stats.PhysicsMS;
568 sb[10].StatValue = m_physicsMS * perframe;
569>>>>>>> avn/ubitvar
514 570
515 sb[11].StatID = (uint)Stats.ImageMS ; 571 sb[11].StatID = (uint)Stats.ImageMS ;
516 sb[11].StatValue = m_imageMS / framesUpdated; 572 sb[11].StatValue = m_imageMS * perframe;
517 573
518 sb[12].StatID = (uint)Stats.OtherMS; 574 sb[12].StatID = (uint)Stats.OtherMS;
575<<<<<<< HEAD
519 //sb[12].StatValue = m_otherMS / framesUpdated; 576 //sb[12].StatValue = m_otherMS / framesUpdated;
520 sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored; 577 sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored;
578=======
579 sb[12].StatValue = m_otherMS * perframe;
580>>>>>>> avn/ubitvar
521 581
522 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 582 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
523 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); 583 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
@@ -529,7 +589,7 @@ namespace OpenSim.Region.Framework.Scenes
529 sb[15].StatValue = m_unAckedBytes; 589 sb[15].StatValue = m_unAckedBytes;
530 590
531 sb[16].StatID = (uint)Stats.AgentMS; 591 sb[16].StatID = (uint)Stats.AgentMS;
532 sb[16].StatValue = m_agentMS / framesUpdated; 592 sb[16].StatValue = m_agentMS * perframe;
533 593
534 sb[17].StatID = (uint)Stats.PendingDownloads; 594 sb[17].StatID = (uint)Stats.PendingDownloads;
535 sb[17].StatValue = m_pendingDownloads; 595 sb[17].StatValue = m_pendingDownloads;
@@ -544,7 +604,10 @@ namespace OpenSim.Region.Framework.Scenes
544 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor; 604 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
545 605
546 sb[21].StatID = (uint)Stats.SimSpareMs; 606 sb[21].StatID = (uint)Stats.SimSpareMs;
547 sb[21].StatValue = m_spareMS / framesUpdated; 607 sb[21].StatValue = sparetime;
608
609 sb[22].StatID = (uint)Stats.SimSleepMs;
610 sb[22].StatValue = sleeptime;
548 611
549 // Current ratio between the sum of physics and sim rate, and the 612 // Current ratio between the sum of physics and sim rate, and the
550 // minimum time to run a scene's frame 613 // minimum time to run a scene's frame
@@ -587,28 +650,32 @@ namespace OpenSim.Region.Framework.Scenes
587 } 650 }
588 651
589 // Extra statistics that aren't currently sent to clients 652 // Extra statistics that aren't currently sent to clients
590 lock (m_lastReportedExtraSimStats) 653 if (m_scene.PhysicsScene != null)
591 { 654 {
592 m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor; 655 lock (m_lastReportedExtraSimStats)
593 m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
594
595 Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
596
597 if (physicsStats != null)
598 { 656 {
599 foreach (KeyValuePair<string, float> tuple in physicsStats) 657 m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates / m_statsUpdateFactor;
658 m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value;
659
660 Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats();
661
662 if (physicsStats != null)
600 { 663 {
601 // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second 664 foreach (KeyValuePair<string, float> tuple in physicsStats)
602 // Need to change things so that stats source can indicate whether they are per second or 665 {
603 // per frame. 666 // FIXME: An extremely dirty hack to divide MS stats per frame rather than per second
604 if (tuple.Key.EndsWith("MS")) 667 // Need to change things so that stats source can indicate whether they are per second or
605 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / framesUpdated; 668 // per frame.
606 else 669 if (tuple.Key.EndsWith("MS"))
607 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; 670 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe;
671 else
672 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
673 }
608 } 674 }
609 } 675 }
610 } 676 }
611 677
678// LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor;
612 ResetValues(); 679 ResetValues();
613 } 680 }
614 } 681 }
@@ -635,8 +702,16 @@ namespace OpenSim.Region.Framework.Scenes
635 m_physicsMS = 0; 702 m_physicsMS = 0;
636 m_imageMS = 0; 703 m_imageMS = 0;
637 m_otherMS = 0; 704 m_otherMS = 0;
705<<<<<<< HEAD
638 m_scriptMS = 0; 706 m_scriptMS = 0;
639 m_spareMS = 0; 707 m_spareMS = 0;
708=======
709// m_spareMS = 0;
710 m_sleeptimeMS = 0;
711
712//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
713//Ckrinke m_scriptMS = 0;
714>>>>>>> avn/ubitvar
640 } 715 }
641 716
642 # region methods called from Scene 717 # region methods called from Scene
@@ -717,11 +792,6 @@ namespace OpenSim.Region.Framework.Scenes
717 SlowFramesStat.Value++; 792 SlowFramesStat.Value++;
718 } 793 }
719 794
720 public void AddSpareMS(int ms)
721 {
722 m_spareMS += ms;
723 }
724
725 public void addNetMS(int ms) 795 public void addNetMS(int ms)
726 { 796 {
727 m_netMS += ms; 797 m_netMS += ms;
@@ -747,6 +817,7 @@ namespace OpenSim.Region.Framework.Scenes
747 m_otherMS += ms; 817 m_otherMS += ms;
748 } 818 }
749 819
820<<<<<<< HEAD
750 public void AddScriptMS(int ms) 821 public void AddScriptMS(int ms)
751 { 822 {
752 m_scriptMS += ms; 823 m_scriptMS += ms;
@@ -776,6 +847,11 @@ namespace OpenSim.Region.Framework.Scenes
776 // first, the next location needs to loop back to the beginning of the 847 // first, the next location needs to loop back to the beginning of the
777 // list whenever it reaches the end 848 // list whenever it reaches the end
778 m_nextLocation = m_nextLocation % m_numberFramesStored; 849 m_nextLocation = m_nextLocation % m_numberFramesStored;
850=======
851 public void addSleepMS(int ms)
852 {
853 m_sleeptimeMS += ms;
854>>>>>>> avn/ubitvar
779 } 855 }
780 856
781 public void AddPendingDownloads(int count) 857 public void AddPendingDownloads(int count)