diff options
author | UbitUmarov | 2015-09-04 12:05:31 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-04 12:05:31 +0100 |
commit | 08f9c54554cec756c2bffad69d2303e227667c17 (patch) | |
tree | 116703f72850e3e2d40b064a5f50f4a39eb41bd5 /OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |
parent | add a GetTimeStampMS method, this returns a time stamp in miliSeconds with th... (diff) | |
download | opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.zip opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.tar.gz opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.tar.bz2 opensim-SC-08f9c54554cec756c2bffad69d2303e227667c17.tar.xz |
use GetTimeStampMS to increase heartbeat and stats timing resolution. some rearrange on stat code ( MOSES special ones still out )
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SimStatsReporter.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 105 |
1 files changed, 52 insertions, 53 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index e0030ec..9f7c769 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -90,7 +90,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
90 | Agents = 13, | 90 | Agents = 13, |
91 | ChildAgents = 14, | 91 | ChildAgents = 14, |
92 | ActiveScripts = 15, | 92 | ActiveScripts = 15, |
93 | ScriptLinesPerSecond = 16, | 93 | LSLScriptLinesPerSecond = 16, // viewers don't like this |
94 | InPacketsPerSecond = 17, | 94 | InPacketsPerSecond = 17, |
95 | OutPacketsPerSecond = 18, | 95 | OutPacketsPerSecond = 18, |
96 | PendingDownloads = 19, | 96 | PendingDownloads = 19, |
@@ -109,11 +109,18 @@ namespace OpenSim.Region.Framework.Scenes | |||
109 | SimSpareMs = 32, | 109 | SimSpareMs = 32, |
110 | SimSleepMs = 33, | 110 | SimSleepMs = 33, |
111 | SimIoPumpTime = 34, | 111 | SimIoPumpTime = 34, |
112 | FrameDilation = 35, | 112 | SimPCTSscriptsRun = 35, |
113 | UsersLoggingIn = 36, | 113 | SimRegionIdle = 36, // dataserver only |
114 | TotalGeoPrim = 37, | 114 | SimRegionIdlePossible = 37, // dataserver only |
115 | TotalMesh = 38, | 115 | SimAIStepTimeMS = 38, |
116 | ThreadCount = 39 | 116 | SimSkippedSillouet_PS = 39, |
117 | SimSkippedCharsPerC = 40, | ||
118 | |||
119 | MOSESFrameDilation = 100, | ||
120 | MOSESUsersLoggingIn = 101, | ||
121 | MOSESTotalGeoPrim = 102, | ||
122 | MOSESTotalMesh = 103, | ||
123 | MOSESThreadCount = 104 | ||
117 | } | 124 | } |
118 | 125 | ||
119 | /// <summary> | 126 | /// <summary> |
@@ -170,7 +177,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
170 | /// <summary> | 177 | /// <summary> |
171 | /// Our nominal fps target, as expected in fps stats when a sim is running normally. | 178 | /// Our nominal fps target, as expected in fps stats when a sim is running normally. |
172 | /// </summary> | 179 | /// </summary> |
173 | private float m_nominalReportedFps = 55; | 180 | private float m_nominalReportedFps = 11; |
174 | 181 | ||
175 | /// <summary> | 182 | /// <summary> |
176 | /// Parameter to adjust reported scene fps | 183 | /// Parameter to adjust reported scene fps |
@@ -197,17 +204,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | /// </summary> | 204 | /// </summary> |
198 | private int m_objectUpdates; | 205 | private int m_objectUpdates; |
199 | 206 | ||
200 | private int m_frameMS; | 207 | private float m_frameMS; |
201 | 208 | ||
202 | private int m_netMS; | 209 | private float m_netMS; |
203 | private int m_agentMS; | 210 | private float m_agentMS; |
204 | private int m_physicsMS; | 211 | private float m_physicsMS; |
205 | private int m_imageMS; | 212 | private float m_imageMS; |
206 | private int m_otherMS; | 213 | private float m_otherMS; |
207 | private int m_sleeptimeMS; | 214 | private float m_sleeptimeMS; |
208 | |||
209 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. | ||
210 | //Ckrinke private int m_scriptMS = 0; | ||
211 | 215 | ||
212 | private int m_rootAgents; | 216 | private int m_rootAgents; |
213 | private int m_childAgents; | 217 | private int m_childAgents; |
@@ -221,7 +225,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
221 | private int m_pendingDownloads; | 225 | private int m_pendingDownloads; |
222 | private int m_pendingUploads = 0; // FIXME: Not currently filled in | 226 | private int m_pendingUploads = 0; // FIXME: Not currently filled in |
223 | private int m_activeScripts; | 227 | private int m_activeScripts; |
224 | private int m_scriptLinesPerSecond; | 228 | // private int m_scriptLinesPerSecond; |
225 | 229 | ||
226 | private int m_objectCapacity = 45000; | 230 | private int m_objectCapacity = 45000; |
227 | 231 | ||
@@ -264,8 +268,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
264 | public SimStatsReporter(Scene scene) | 268 | public SimStatsReporter(Scene scene) |
265 | { | 269 | { |
266 | m_scene = scene; | 270 | m_scene = scene; |
267 | m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; | 271 | // m_reportedFpsCorrectionFactor = 5.0f; // needs to come from config |
268 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 272 | m_reportedFpsCorrectionFactor = 1.0f; // needs to come from config |
273 | m_nominalReportedFps *= m_reportedFpsCorrectionFactor; | ||
274 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f); | ||
269 | ReportingRegion = scene.RegionInfo; | 275 | ReportingRegion = scene.RegionInfo; |
270 | 276 | ||
271 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; | 277 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; |
@@ -310,7 +316,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
310 | public void SetUpdateMS(int ms) | 316 | public void SetUpdateMS(int ms) |
311 | { | 317 | { |
312 | m_statsUpdatesEveryMS = ms; | 318 | m_statsUpdatesEveryMS = ms; |
313 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 319 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000.0f); |
314 | m_report.Interval = m_statsUpdatesEveryMS; | 320 | m_report.Interval = m_statsUpdatesEveryMS; |
315 | } | 321 | } |
316 | 322 | ||
@@ -333,8 +339,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
333 | if (!m_scene.Active) | 339 | if (!m_scene.Active) |
334 | return; | 340 | return; |
335 | 341 | ||
336 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; | 342 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; |
337 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 343 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
338 | 344 | ||
339 | // Know what's not thread safe in Mono... modifying timers. | 345 | // Know what's not thread safe in Mono... modifying timers. |
340 | // m_log.Debug("Firing Stats Heart Beat"); | 346 | // m_log.Debug("Firing Stats Heart Beat"); |
@@ -354,21 +360,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
354 | } | 360 | } |
355 | 361 | ||
356 | #region various statistic googly moogly | 362 | #region various statistic googly moogly |
357 | 363 | int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | |
358 | // ORIGINAL code commented out until we have time to add our own | ||
359 | // statistics to the statistics window, this will be done as a | ||
360 | // new section given the title of our current project | ||
361 | // We're going to lie about the FPS because we've been lying since 2008. The actual FPS is currently | ||
362 | // locked at a maximum of 11. Maybe at some point this can change so that we're not lying. | ||
363 | //int reportedFPS = (int)(m_fps * m_reportedFpsCorrectionFactor); | ||
364 | int reportedFPS = m_fps; | ||
365 | 364 | ||
366 | // save the reported value so there is something available for llGetRegionFPS | 365 | // save the reported value so there is something available for llGetRegionFPS |
367 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; | 366 | lastReportedSimFPS = reportedFPS / m_statsUpdateFactor; |
368 | 367 | ||
369 | // ORIGINAL code commented out until we have time to add our own | 368 | // ORIGINAL code commented out until we have time to add our own |
370 | // statistics to the statistics window | 369 | // statistics to the statistics window |
371 | float physfps = ((m_pfps / 1000)); | 370 | float physfps = ((m_pfps / 1000.0f)); |
372 | 371 | ||
373 | //if (physfps > 600) | 372 | //if (physfps > 600) |
374 | //physfps = physfps - (physfps - 600); | 373 | //physfps = physfps - (physfps - 600); |
@@ -377,7 +376,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
377 | physfps = 0; | 376 | physfps = 0; |
378 | 377 | ||
379 | #endregion | 378 | #endregion |
380 | float factor = 1 / m_statsUpdateFactor; | 379 | float factor = 1.0f / m_statsUpdateFactor; |
381 | 380 | ||
382 | if (reportedFPS <= 0) | 381 | if (reportedFPS <= 0) |
383 | reportedFPS = 1; | 382 | reportedFPS = 1; |
@@ -386,7 +385,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
386 | 385 | ||
387 | float TotalFrameTime = m_frameMS * perframe; | 386 | float TotalFrameTime = m_frameMS * perframe; |
388 | 387 | ||
389 | float targetframetime = 1100.0f / (float)m_nominalReportedFps; | 388 | float targetframetime = 1000.0f / (float)m_nominalReportedFps; |
390 | 389 | ||
391 | float sparetime; | 390 | float sparetime; |
392 | float sleeptime; | 391 | float sleeptime; |
@@ -431,10 +430,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
431 | { | 430 | { |
432 | sb[i] = new SimStatsPacket.StatBlock(); | 431 | sb[i] = new SimStatsPacket.StatBlock(); |
433 | } | 432 | } |
434 | 433 | ||
435 | |||
436 | sb[0].StatID = (uint) Stats.TimeDilation; | 434 | sb[0].StatID = (uint) Stats.TimeDilation; |
437 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 435 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; |
438 | 436 | ||
439 | sb[1].StatID = (uint) Stats.SimFPS; | 437 | sb[1].StatID = (uint) Stats.SimFPS; |
440 | sb[1].StatValue = reportedFPS / m_statsUpdateFactor; | 438 | sb[1].StatValue = reportedFPS / m_statsUpdateFactor; |
@@ -493,14 +491,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
493 | sb[19].StatID = (uint)Stats.ActiveScripts; | 491 | sb[19].StatID = (uint)Stats.ActiveScripts; |
494 | sb[19].StatValue = m_activeScripts; | 492 | sb[19].StatValue = m_activeScripts; |
495 | 493 | ||
496 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; | 494 | sb[20].StatID = (uint)Stats.SimSpareMs; |
497 | sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor; | 495 | sb[20].StatValue = sparetime; |
498 | 496 | ||
499 | sb[21].StatID = (uint)Stats.SimSpareMs; | 497 | sb[21].StatID = (uint)Stats.SimSleepMs; |
500 | sb[21].StatValue = sparetime; | 498 | sb[21].StatValue = sleeptime; |
501 | 499 | ||
502 | sb[22].StatID = (uint)Stats.SimSleepMs; | 500 | // this should came from phys engine |
503 | sb[22].StatValue = sleeptime; | 501 | sb[22].StatID = (uint)Stats.SimPhysicsStepMs; |
502 | sb[22].StatValue = 20; | ||
504 | 503 | ||
505 | for (int i = 0; i < 23; i++) | 504 | for (int i = 0; i < 23; i++) |
506 | { | 505 | { |
@@ -563,7 +562,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
563 | //m_inPacketsPerSecond = 0; | 562 | //m_inPacketsPerSecond = 0; |
564 | //m_outPacketsPerSecond = 0; | 563 | //m_outPacketsPerSecond = 0; |
565 | m_unAckedBytes = 0; | 564 | m_unAckedBytes = 0; |
566 | m_scriptLinesPerSecond = 0; | 565 | // m_scriptLinesPerSecond = 0; |
567 | 566 | ||
568 | m_frameMS = 0; | 567 | m_frameMS = 0; |
569 | m_agentMS = 0; | 568 | m_agentMS = 0; |
@@ -571,7 +570,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
571 | m_physicsMS = 0; | 570 | m_physicsMS = 0; |
572 | m_imageMS = 0; | 571 | m_imageMS = 0; |
573 | m_otherMS = 0; | 572 | m_otherMS = 0; |
574 | // m_spareMS = 0; | ||
575 | m_sleeptimeMS = 0; | 573 | m_sleeptimeMS = 0; |
576 | 574 | ||
577 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 575 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
@@ -646,7 +644,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
646 | if (m_unAckedBytes < 0) m_unAckedBytes = 0; | 644 | if (m_unAckedBytes < 0) m_unAckedBytes = 0; |
647 | } | 645 | } |
648 | 646 | ||
649 | public void addFrameMS(int ms) | 647 | public void addFrameMS(float ms) |
650 | { | 648 | { |
651 | m_frameMS += ms; | 649 | m_frameMS += ms; |
652 | 650 | ||
@@ -656,32 +654,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
656 | SlowFramesStat.Value++; | 654 | SlowFramesStat.Value++; |
657 | } | 655 | } |
658 | 656 | ||
659 | public void addNetMS(int ms) | 657 | public void addNetMS(float ms) |
660 | { | 658 | { |
661 | m_netMS += ms; | 659 | m_netMS += ms; |
662 | } | 660 | } |
663 | 661 | ||
664 | public void addAgentMS(int ms) | 662 | public void addAgentMS(float ms) |
665 | { | 663 | { |
666 | m_agentMS += ms; | 664 | m_agentMS += ms; |
667 | } | 665 | } |
668 | 666 | ||
669 | public void addPhysicsMS(int ms) | 667 | public void addPhysicsMS(float ms) |
670 | { | 668 | { |
671 | m_physicsMS += ms; | 669 | m_physicsMS += ms; |
672 | } | 670 | } |
673 | 671 | ||
674 | public void addImageMS(int ms) | 672 | public void addImageMS(float ms) |
675 | { | 673 | { |
676 | m_imageMS += ms; | 674 | m_imageMS += ms; |
677 | } | 675 | } |
678 | 676 | ||
679 | public void addOtherMS(int ms) | 677 | public void addOtherMS(float ms) |
680 | { | 678 | { |
681 | m_otherMS += ms; | 679 | m_otherMS += ms; |
682 | } | 680 | } |
683 | 681 | ||
684 | public void addSleepMS(int ms) | 682 | public void addSleepMS(float ms) |
685 | { | 683 | { |
686 | m_sleeptimeMS += ms; | 684 | m_sleeptimeMS += ms; |
687 | } | 685 | } |
@@ -698,7 +696,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
698 | 696 | ||
699 | public void addScriptLines(int count) | 697 | public void addScriptLines(int count) |
700 | { | 698 | { |
701 | m_scriptLinesPerSecond += count; | 699 | // we need events not lines |
700 | // m_scriptLinesPerSecond += count; | ||
702 | } | 701 | } |
703 | 702 | ||
704 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) | 703 | public void AddPacketsStats(int inPackets, int outPackets, int unAckedBytes) |