diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SimStatsReporter.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 286 |
1 files changed, 146 insertions, 140 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index bf65cab..c8f525e 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -176,10 +176,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
176 | // Sending a stats update every 3 seconds- | 176 | // Sending a stats update every 3 seconds- |
177 | private int m_statsUpdatesEveryMS = 3000; | 177 | private int m_statsUpdatesEveryMS = 3000; |
178 | private double m_lastUpdateTS; | 178 | private double m_lastUpdateTS; |
179 | private double m_prevFrameStatsTS; | ||
180 | private double m_FrameStatsTS; | ||
179 | private float m_timeDilation; | 181 | private float m_timeDilation; |
180 | private int m_fps; | 182 | private int m_fps; |
181 | 183 | ||
182 | private object m_statsLock = new object(); | 184 | private object m_statsLock = new object(); |
185 | private object m_statsFrameLock = new object(); | ||
183 | 186 | ||
184 | /// <summary> | 187 | /// <summary> |
185 | /// Parameter to adjust reported scene fps | 188 | /// Parameter to adjust reported scene fps |
@@ -195,7 +198,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
195 | /// corresponding, with default heartbeat rate, to a value of 5. | 198 | /// corresponding, with default heartbeat rate, to a value of 5. |
196 | /// </remarks> | 199 | /// </remarks> |
197 | private float m_statisticsFPSfactor = 5.0f; | 200 | private float m_statisticsFPSfactor = 5.0f; |
198 | 201 | private float m_targetFrameTime = 0.1f; | |
199 | // saved last reported value so there is something available for llGetRegionFPS | 202 | // saved last reported value so there is something available for llGetRegionFPS |
200 | private float lastReportedSimFPS; | 203 | private float lastReportedSimFPS; |
201 | private float[] lastReportedSimStats = new float[m_statisticExtraArraySize + m_statisticViewerArraySize]; | 204 | private float[] lastReportedSimStats = new float[m_statisticExtraArraySize + m_statisticViewerArraySize]; |
@@ -219,6 +222,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
219 | private float m_imageMS; | 222 | private float m_imageMS; |
220 | private float m_otherMS; | 223 | private float m_otherMS; |
221 | private float m_sleeptimeMS; | 224 | private float m_sleeptimeMS; |
225 | private float m_scriptTimeMS; | ||
222 | 226 | ||
223 | private int m_rootAgents; | 227 | private int m_rootAgents; |
224 | private int m_childAgents; | 228 | private int m_childAgents; |
@@ -257,7 +261,13 @@ namespace OpenSim.Region.Framework.Scenes | |||
257 | m_scene = scene; | 261 | m_scene = scene; |
258 | 262 | ||
259 | ReportingRegion = scene.RegionInfo; | 263 | ReportingRegion = scene.RegionInfo; |
260 | m_statisticsFPSfactor = scene.StatisticsFPSfactor; | 264 | |
265 | if(scene.Normalized55FPS) | ||
266 | m_statisticsFPSfactor = 55.0f * m_scene.FrameTime; | ||
267 | else | ||
268 | m_statisticsFPSfactor = 1.0f; | ||
269 | |||
270 | m_targetFrameTime = 1000.0f * m_scene.FrameTime / m_statisticsFPSfactor; | ||
261 | 271 | ||
262 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; | 272 | m_objectCapacity = scene.RegionInfo.ObjectCapacity; |
263 | m_report.AutoReset = true; | 273 | m_report.AutoReset = true; |
@@ -266,6 +276,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
266 | m_report.Enabled = true; | 276 | m_report.Enabled = true; |
267 | 277 | ||
268 | m_lastUpdateTS = Util.GetTimeStampMS(); | 278 | m_lastUpdateTS = Util.GetTimeStampMS(); |
279 | m_FrameStatsTS = m_lastUpdateTS; | ||
280 | m_prevFrameStatsTS = m_lastUpdateTS; | ||
269 | 281 | ||
270 | if (StatsManager.SimExtraStats != null) | 282 | if (StatsManager.SimExtraStats != null) |
271 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; | 283 | OnSendStatsResult += StatsManager.SimExtraStats.ReceiveClassicSimStatsPacket; |
@@ -350,28 +362,92 @@ namespace OpenSim.Region.Framework.Scenes | |||
350 | #region various statistic googly moogly | 362 | #region various statistic googly moogly |
351 | double timeTmp = m_lastUpdateTS; | 363 | double timeTmp = m_lastUpdateTS; |
352 | m_lastUpdateTS = Util.GetTimeStampMS(); | 364 | m_lastUpdateTS = Util.GetTimeStampMS(); |
353 | 365 | float updateElapsed = (float)((m_lastUpdateTS - timeTmp)/1000.0); | |
354 | float m_statsUpdateFactor = (float)((m_lastUpdateTS - timeTmp)/1000.0); | ||
355 | 366 | ||
356 | // factor to consider updates integration time | 367 | // factor to consider updates integration time |
357 | float updateFactor = 1.0f / m_statsUpdateFactor; | 368 | float updateTimeFactor = 1.0f / updateElapsed; |
369 | |||
370 | |||
371 | // scene frame stats | ||
372 | float reportedFPS; | ||
373 | float physfps; | ||
374 | float timeDilation; | ||
375 | float agentMS; | ||
376 | float physicsMS; | ||
377 | float otherMS; | ||
378 | float sleeptime; | ||
379 | float scriptTimeMS; | ||
380 | float totalFrameTime; | ||
381 | |||
382 | float invFrameElapsed; | ||
358 | 383 | ||
359 | // the nominal frame time, corrected by reporting multiplier | 384 | // get a copy under lock and reset |
360 | float TargetFrameTime = 1000.0f * m_scene.FrameTime / m_statisticsFPSfactor; | 385 | lock(m_statsFrameLock) |
386 | { | ||
387 | timeDilation = m_timeDilation; | ||
388 | reportedFPS = m_fps; | ||
389 | physfps = m_pfps; | ||
390 | agentMS = m_agentMS; | ||
391 | physicsMS = m_physicsMS; | ||
392 | otherMS = m_otherMS; | ||
393 | sleeptime = m_sleeptimeMS; | ||
394 | scriptTimeMS = m_scriptTimeMS; | ||
395 | totalFrameTime = m_frameMS; | ||
396 | // still not inv | ||
397 | invFrameElapsed = (float)((m_FrameStatsTS - m_prevFrameStatsTS) / 1000.0); | ||
398 | |||
399 | ResetFrameStats(); | ||
400 | } | ||
361 | 401 | ||
362 | // acumulated fps scaled by reporting multiplier | 402 | if (invFrameElapsed / updateElapsed < 0.8) |
363 | float reportedFPS = (m_fps * m_statisticsFPSfactor); | 403 | // scene is in trouble, its account of time is most likely wrong |
404 | // can even be in stall | ||
405 | invFrameElapsed = updateTimeFactor; | ||
406 | else | ||
407 | invFrameElapsed = 1.0f / invFrameElapsed; | ||
408 | |||
409 | float perframefactor; | ||
364 | if (reportedFPS <= 0) | 410 | if (reportedFPS <= 0) |
365 | reportedFPS = 1; | 411 | { |
412 | reportedFPS = 0.0f; | ||
413 | physfps = 0.0f; | ||
414 | perframefactor = 1.0f; | ||
415 | timeDilation = 0.0f; | ||
416 | } | ||
417 | else | ||
418 | { | ||
419 | timeDilation /= reportedFPS; | ||
420 | reportedFPS *= m_statisticsFPSfactor; | ||
421 | perframefactor = 1.0f / (float)reportedFPS; | ||
422 | reportedFPS *= invFrameElapsed; | ||
423 | physfps *= invFrameElapsed * m_statisticsFPSfactor; | ||
424 | } | ||
366 | 425 | ||
367 | // factor to calculate per frame values | 426 | // some engines track frame time with error related to the simulation step size |
368 | float perframefactor = 1.0f / (float)reportedFPS; | 427 | if(physfps > reportedFPS) |
428 | physfps = reportedFPS; | ||
369 | 429 | ||
370 | // fps considering the integration time | ||
371 | reportedFPS = reportedFPS * updateFactor; | ||
372 | // save the reported value so there is something available for llGetRegionFPS | 430 | // save the reported value so there is something available for llGetRegionFPS |
373 | lastReportedSimFPS = reportedFPS; | 431 | lastReportedSimFPS = reportedFPS; |
374 | 432 | ||
433 | // scale frame stats | ||
434 | |||
435 | totalFrameTime *= perframefactor; | ||
436 | sleeptime *= perframefactor; | ||
437 | otherMS *= perframefactor; | ||
438 | physicsMS *= perframefactor; | ||
439 | agentMS *= perframefactor; | ||
440 | scriptTimeMS *= perframefactor; | ||
441 | |||
442 | // estimate spare time | ||
443 | float sparetime; | ||
444 | sparetime = m_targetFrameTime - (physicsMS + agentMS + otherMS); | ||
445 | |||
446 | if (sparetime < 0) | ||
447 | sparetime = 0; | ||
448 | else if (sparetime > totalFrameTime) | ||
449 | sparetime = totalFrameTime; | ||
450 | |||
375 | #endregion | 451 | #endregion |
376 | 452 | ||
377 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); | 453 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); |
@@ -381,44 +457,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
381 | m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount(); | 457 | m_numMesh = m_scene.SceneGraph.GetTotalMeshObjectsCount(); |
382 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); | 458 | m_activePrim = m_scene.SceneGraph.GetActiveObjectsCount(); |
383 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); | 459 | m_activeScripts = m_scene.SceneGraph.GetActiveScriptsCount(); |
460 | m_scriptLinesPerSecond = m_scene.SceneGraph.GetScriptLPS(); | ||
384 | 461 | ||
385 | float physfps = m_pfps * updateFactor * m_statisticsFPSfactor; | 462 | // FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code |
386 | if (physfps < 0) | ||
387 | physfps = 0; | ||
388 | else if(physfps > reportedFPS) | ||
389 | physfps = reportedFPS; // pretend we are not insane | ||
390 | |||
391 | float sparetime; | ||
392 | float sleeptime; | ||
393 | |||
394 | float TotalFrameTime = m_frameMS * perframefactor; | ||
395 | sleeptime = m_sleeptimeMS * perframefactor; | ||
396 | |||
397 | sparetime = m_frameMS - m_sleeptimeMS; // total time minus sleep | ||
398 | sparetime *= perframefactor; // average per frame | ||
399 | sparetime = TargetFrameTime - sparetime; // real spare | ||
400 | if (sparetime < 0) | ||
401 | sparetime = 0; | ||
402 | else if (sparetime > TotalFrameTime) | ||
403 | sparetime = TotalFrameTime; | ||
404 | |||
405 | // don't send meaning less precision | ||
406 | reportedFPS = (float)Math.Round(reportedFPS,1); | ||
407 | physfps = (float)Math.Round(physfps,1); | ||
408 | |||
409 | // FIXME: Checking for stat sanity is a complex approach. What we really need to do is fix the code | ||
410 | // so that stat numbers are always consistent. | 463 | // so that stat numbers are always consistent. |
411 | CheckStatSanity(); | 464 | CheckStatSanity(); |
412 | |||
413 | // other MS is actually simulation time | ||
414 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; | ||
415 | // m_imageMS m_netMS are not included in m_frameMS | ||
416 | |||
417 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; | ||
418 | if (m_otherMS < 0) | ||
419 | m_otherMS = 0; | ||
420 | |||
421 | float scriptTimeMS = m_scene.GetAndResetScriptExecutionTime(); | ||
422 | 465 | ||
423 | for (int i = 0; i < m_statisticViewerArraySize; i++) | 466 | for (int i = 0; i < m_statisticViewerArraySize; i++) |
424 | { | 467 | { |
@@ -426,16 +469,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
426 | } | 469 | } |
427 | 470 | ||
428 | sb[0].StatID = (uint) Stats.TimeDilation; | 471 | sb[0].StatID = (uint) Stats.TimeDilation; |
429 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; | 472 | sb[0].StatValue = (Single.IsNaN(timeDilation)) ? 0.0f : (float)Math.Round(timeDilation,3); |
430 | 473 | ||
431 | sb[1].StatID = (uint) Stats.SimFPS; | 474 | sb[1].StatID = (uint) Stats.SimFPS; |
432 | sb[1].StatValue = reportedFPS; | 475 | sb[1].StatValue = (float)Math.Round(reportedFPS,1);; |
433 | 476 | ||
434 | sb[2].StatID = (uint) Stats.PhysicsFPS; | 477 | sb[2].StatID = (uint) Stats.PhysicsFPS; |
435 | sb[2].StatValue = physfps; | 478 | sb[2].StatValue = (float)Math.Round(physfps,1); |
436 | 479 | ||
437 | sb[3].StatID = (uint) Stats.AgentUpdates; | 480 | sb[3].StatID = (uint) Stats.AgentUpdates; |
438 | sb[3].StatValue = m_agentUpdates * updateFactor; | 481 | sb[3].StatValue = m_agentUpdates * updateTimeFactor; |
439 | 482 | ||
440 | sb[4].StatID = (uint) Stats.Agents; | 483 | sb[4].StatID = (uint) Stats.Agents; |
441 | sb[4].StatValue = m_rootAgents; | 484 | sb[4].StatValue = m_rootAgents; |
@@ -450,31 +493,31 @@ namespace OpenSim.Region.Framework.Scenes | |||
450 | sb[7].StatValue = m_activePrim; | 493 | sb[7].StatValue = m_activePrim; |
451 | 494 | ||
452 | sb[8].StatID = (uint)Stats.FrameMS; | 495 | sb[8].StatID = (uint)Stats.FrameMS; |
453 | sb[8].StatValue = TotalFrameTime; | 496 | sb[8].StatValue = totalFrameTime; |
454 | 497 | ||
455 | sb[9].StatID = (uint)Stats.NetMS; | 498 | sb[9].StatID = (uint)Stats.NetMS; |
456 | sb[9].StatValue = m_netMS * perframefactor; | 499 | sb[9].StatValue = m_netMS * perframefactor; |
457 | 500 | ||
458 | sb[10].StatID = (uint)Stats.PhysicsMS; | 501 | sb[10].StatID = (uint)Stats.PhysicsMS; |
459 | sb[10].StatValue = m_physicsMS * perframefactor; | 502 | sb[10].StatValue = physicsMS; |
460 | 503 | ||
461 | sb[11].StatID = (uint)Stats.ImageMS ; | 504 | sb[11].StatID = (uint)Stats.ImageMS ; |
462 | sb[11].StatValue = m_imageMS * perframefactor; | 505 | sb[11].StatValue = m_imageMS * perframefactor; |
463 | 506 | ||
464 | sb[12].StatID = (uint)Stats.OtherMS; | 507 | sb[12].StatID = (uint)Stats.OtherMS; |
465 | sb[12].StatValue = m_otherMS * perframefactor; | 508 | sb[12].StatValue = otherMS; |
466 | 509 | ||
467 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 510 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
468 | sb[13].StatValue = (m_inPacketsPerSecond * updateFactor); | 511 | sb[13].StatValue = (float)Math.Round(m_inPacketsPerSecond * updateTimeFactor); |
469 | 512 | ||
470 | sb[14].StatID = (uint)Stats.OutPacketsPerSecond; | 513 | sb[14].StatID = (uint)Stats.OutPacketsPerSecond; |
471 | sb[14].StatValue = (m_outPacketsPerSecond * updateFactor); | 514 | sb[14].StatValue = (float)Math.Round(m_outPacketsPerSecond * updateTimeFactor); |
472 | 515 | ||
473 | sb[15].StatID = (uint)Stats.UnAckedBytes; | 516 | sb[15].StatID = (uint)Stats.UnAckedBytes; |
474 | sb[15].StatValue = m_unAckedBytes; | 517 | sb[15].StatValue = m_unAckedBytes; |
475 | 518 | ||
476 | sb[16].StatID = (uint)Stats.AgentMS; | 519 | sb[16].StatID = (uint)Stats.AgentMS; |
477 | sb[16].StatValue = m_agentMS * perframefactor; | 520 | sb[16].StatValue = agentMS; |
478 | 521 | ||
479 | sb[17].StatID = (uint)Stats.PendingDownloads; | 522 | sb[17].StatID = (uint)Stats.PendingDownloads; |
480 | sb[17].StatValue = m_pendingDownloads; | 523 | sb[17].StatValue = m_pendingDownloads; |
@@ -514,7 +557,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
514 | sb[27].StatValue = 0; | 557 | sb[27].StatValue = 0; |
515 | 558 | ||
516 | sb[28].StatID = (uint)Stats.ScriptEps; // we actuall have this, but not messing array order AGAIN | 559 | sb[28].StatID = (uint)Stats.ScriptEps; // we actuall have this, but not messing array order AGAIN |
517 | sb[28].StatValue = m_scriptEventsPerSecond * updateFactor; | 560 | sb[28].StatValue = (float)Math.Round(m_scriptEventsPerSecond * updateTimeFactor); |
518 | 561 | ||
519 | sb[29].StatID = (uint)Stats.SimAIStepTimeMS; | 562 | sb[29].StatID = (uint)Stats.SimAIStepTimeMS; |
520 | sb[29].StatValue = 0; | 563 | sb[29].StatValue = 0; |
@@ -541,8 +584,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
541 | sb[36].StatValue = 0; | 584 | sb[36].StatValue = 0; |
542 | 585 | ||
543 | sb[37].StatID = (uint)Stats.ScriptMS; | 586 | sb[37].StatID = (uint)Stats.ScriptMS; |
544 | sb[37].StatValue = scriptTimeMS * perframefactor; | 587 | sb[37].StatValue = scriptTimeMS; |
545 | |||
546 | 588 | ||
547 | for (int i = 0; i < m_statisticViewerArraySize; i++) | 589 | for (int i = 0; i < m_statisticViewerArraySize; i++) |
548 | { | 590 | { |
@@ -558,12 +600,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
558 | } | 600 | } |
559 | 601 | ||
560 | sbex[0].StatID = (uint)Stats.LSLScriptLinesPerSecond; | 602 | sbex[0].StatID = (uint)Stats.LSLScriptLinesPerSecond; |
561 | sbex[0].StatValue = m_scriptLinesPerSecond * updateFactor; | 603 | sbex[0].StatValue = m_scriptLinesPerSecond * updateTimeFactor; |
562 | lastReportedSimStats[38] = m_scriptLinesPerSecond * updateFactor; | 604 | lastReportedSimStats[38] = m_scriptLinesPerSecond * updateTimeFactor; |
563 | 605 | ||
564 | sbex[1].StatID = (uint)Stats.FrameDilation2; | 606 | sbex[1].StatID = (uint)Stats.FrameDilation2; |
565 | sbex[1].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation; | 607 | sbex[1].StatValue = (Single.IsNaN(timeDilation)) ? 0.1f : timeDilation; |
566 | lastReportedSimStats[39] = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation; | 608 | lastReportedSimStats[39] = (Single.IsNaN(timeDilation)) ? 0.1f : timeDilation; |
567 | 609 | ||
568 | sbex[2].StatID = (uint)Stats.UsersLoggingIn; | 610 | sbex[2].StatID = (uint)Stats.UsersLoggingIn; |
569 | sbex[2].StatValue = m_usersLoggingIn; | 611 | sbex[2].StatValue = m_usersLoggingIn; |
@@ -597,7 +639,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
597 | { | 639 | { |
598 | lock (m_lastReportedExtraSimStats) | 640 | lock (m_lastReportedExtraSimStats) |
599 | { | 641 | { |
600 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates * updateFactor; | 642 | m_lastReportedExtraSimStats[LastReportedObjectUpdateStatName] = m_objectUpdates * updateTimeFactor; |
601 | m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value; | 643 | m_lastReportedExtraSimStats[SlowFramesStat.ShortName] = (float)SlowFramesStat.Value; |
602 | 644 | ||
603 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); | 645 | Dictionary<string, float> physicsStats = m_scene.PhysicsScene.GetStats(); |
@@ -612,7 +654,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
612 | if (tuple.Key.EndsWith("MS")) | 654 | if (tuple.Key.EndsWith("MS")) |
613 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframefactor; | 655 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframefactor; |
614 | else | 656 | else |
615 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * updateFactor; | 657 | m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * updateTimeFactor; |
616 | } | 658 | } |
617 | } | 659 | } |
618 | } | 660 | } |
@@ -626,47 +668,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
626 | 668 | ||
627 | private void ResetValues() | 669 | private void ResetValues() |
628 | { | 670 | { |
629 | // Reset the number of frames that the physics library has | ||
630 | // processed since the last stats report | ||
631 | |||
632 | m_timeDilation = 0; | ||
633 | m_fps = 0; | ||
634 | m_pfps = 0; | ||
635 | m_agentUpdates = 0; | 671 | m_agentUpdates = 0; |
636 | m_objectUpdates = 0; | 672 | m_objectUpdates = 0; |
637 | //m_inPacketsPerSecond = 0; | ||
638 | //m_outPacketsPerSecond = 0; | ||
639 | m_unAckedBytes = 0; | 673 | m_unAckedBytes = 0; |
640 | m_scriptLinesPerSecond = 0; | ||
641 | m_scriptEventsPerSecond = 0; | 674 | m_scriptEventsPerSecond = 0; |
642 | 675 | ||
643 | m_frameMS = 0; | ||
644 | m_agentMS = 0; | ||
645 | m_netMS = 0; | 676 | m_netMS = 0; |
646 | m_physicsMS = 0; | ||
647 | m_imageMS = 0; | 677 | m_imageMS = 0; |
648 | m_otherMS = 0; | ||
649 | m_sleeptimeMS = 0; | ||
650 | |||
651 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | ||
652 | //Ckrinke m_scriptMS = 0; | ||
653 | } | 678 | } |
654 | 679 | ||
655 | # region methods called from Scene | ||
656 | // The majority of these functions are additive | ||
657 | // so that you can easily change the amount of | ||
658 | // seconds in between sim stats updates | ||
659 | |||
660 | public void AddTimeDilation(float td) | ||
661 | { | ||
662 | //float tdsetting = td; | ||
663 | //if (tdsetting > 1.0f) | ||
664 | //tdsetting = (tdsetting - (tdsetting - 0.91f)); | ||
665 | |||
666 | //if (tdsetting < 0) | ||
667 | //tdsetting = 0.0f; | ||
668 | m_timeDilation = td; | ||
669 | } | ||
670 | 680 | ||
671 | internal void CheckStatSanity() | 681 | internal void CheckStatSanity() |
672 | { | 682 | { |
@@ -684,14 +694,44 @@ namespace OpenSim.Region.Framework.Scenes | |||
684 | } | 694 | } |
685 | } | 695 | } |
686 | 696 | ||
687 | public void AddFPS(int frames) | 697 | # region methods called from Scene |
698 | |||
699 | public void AddFrameStats(float _timeDilation, float _physicsFPS, float _agentMS, | ||
700 | float _physicsMS, float _otherMS , float _sleepMS, | ||
701 | float _frameMS, float _scriptTimeMS) | ||
688 | { | 702 | { |
689 | m_fps += frames; | 703 | lock(m_statsFrameLock) |
690 | } | 704 | { |
705 | m_fps++; | ||
706 | m_timeDilation += _timeDilation; | ||
707 | m_pfps += _physicsFPS; | ||
708 | m_agentMS += _agentMS; | ||
709 | m_physicsMS += _physicsMS; | ||
710 | m_otherMS += _otherMS; | ||
711 | m_sleeptimeMS += _sleepMS; | ||
712 | m_frameMS += _frameMS; | ||
713 | m_scriptTimeMS += _scriptTimeMS; | ||
714 | |||
715 | if (_frameMS > SlowFramesStatReportThreshold) | ||
716 | SlowFramesStat.Value++; | ||
717 | |||
718 | m_FrameStatsTS = Util.GetTimeStampMS(); | ||
719 | } | ||
720 | } | ||
691 | 721 | ||
692 | public void AddPhysicsFPS(float frames) | 722 | private void ResetFrameStats() |
693 | { | 723 | { |
694 | m_pfps += frames; | 724 | m_fps = 0; |
725 | m_timeDilation = 0.0f; | ||
726 | m_pfps = 0.0f; | ||
727 | m_agentMS = 0.0f; | ||
728 | m_physicsMS = 0.0f; | ||
729 | m_otherMS = 0.0f; | ||
730 | m_sleeptimeMS = 0.0f; | ||
731 | m_frameMS = 0.0f; | ||
732 | m_scriptTimeMS = 0.0f; | ||
733 | |||
734 | m_prevFrameStatsTS = m_FrameStatsTS; | ||
695 | } | 735 | } |
696 | 736 | ||
697 | public void AddObjectUpdates(int numUpdates) | 737 | public void AddObjectUpdates(int numUpdates) |
@@ -720,46 +760,17 @@ namespace OpenSim.Region.Framework.Scenes | |||
720 | if (m_unAckedBytes < 0) m_unAckedBytes = 0; | 760 | if (m_unAckedBytes < 0) m_unAckedBytes = 0; |
721 | } | 761 | } |
722 | 762 | ||
723 | public void addFrameMS(float ms) | ||
724 | { | ||
725 | m_frameMS += ms; | ||
726 | |||
727 | // At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | ||
728 | // longer than ideal due to the inaccuracy of the Sleep in Scene.Update() (which in itself is a concern). | ||
729 | if (ms > SlowFramesStatReportThreshold) | ||
730 | SlowFramesStat.Value++; | ||
731 | } | ||
732 | 763 | ||
733 | public void addNetMS(float ms) | 764 | public void addNetMS(float ms) |
734 | { | 765 | { |
735 | m_netMS += ms; | 766 | m_netMS += ms; |
736 | } | 767 | } |
737 | 768 | ||
738 | public void addAgentMS(float ms) | ||
739 | { | ||
740 | m_agentMS += ms; | ||
741 | } | ||
742 | |||
743 | public void addPhysicsMS(float ms) | ||
744 | { | ||
745 | m_physicsMS += ms; | ||
746 | } | ||
747 | |||
748 | public void addImageMS(float ms) | 769 | public void addImageMS(float ms) |
749 | { | 770 | { |
750 | m_imageMS += ms; | 771 | m_imageMS += ms; |
751 | } | 772 | } |
752 | 773 | ||
753 | public void addOtherMS(float ms) | ||
754 | { | ||
755 | m_otherMS += ms; | ||
756 | } | ||
757 | |||
758 | public void addSleepMS(float ms) | ||
759 | { | ||
760 | m_sleeptimeMS += ms; | ||
761 | } | ||
762 | |||
763 | public void AddPendingDownloads(int count) | 774 | public void AddPendingDownloads(int count) |
764 | { | 775 | { |
765 | m_pendingDownloads += count; | 776 | m_pendingDownloads += count; |
@@ -770,11 +781,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
770 | //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads); | 781 | //m_log.InfoFormat("[stats]: Adding {0} to pending downloads to make {1}", count, m_pendingDownloads); |
771 | } | 782 | } |
772 | 783 | ||
773 | public void addScriptLines(int count) | ||
774 | { | ||
775 | m_scriptLinesPerSecond += count; | ||
776 | } | ||
777 | |||
778 | public void addScriptEvents(int count) | 784 | public void addScriptEvents(int count) |
779 | { | 785 | { |
780 | m_scriptEventsPerSecond += count; | 786 | m_scriptEventsPerSecond += count; |