diff options
author | UbitUmarov | 2015-09-02 19:54:53 +0100 |
---|---|---|
committer | UbitUmarov | 2015-09-02 19:54:53 +0100 |
commit | a11edceb00b5b86f825bd957bdac9edb91f893dd (patch) | |
tree | c192eae26f3aadf365a66f32fc6d9ade2f0a0c61 /OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |
parent | bad merge? (diff) | |
download | opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.zip opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.gz opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.bz2 opensim-SC-a11edceb00b5b86f825bd957bdac9edb91f893dd.tar.xz |
seems to compile ( tests comented out)
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SimStatsReporter.cs')
-rwxr-xr-x | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 182 |
1 files changed, 7 insertions, 175 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 52e3ff1..bdddd73 100755 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -184,11 +184,7 @@ 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 | ||
188 | private float[] lastReportedSimStats = new float[m_statisticArraySize]; | ||
189 | ======= | ||
190 | private float[] lastReportedSimStats = new float[23]; | 187 | private float[] lastReportedSimStats = new float[23]; |
191 | >>>>>>> avn/ubitvar | ||
192 | private float m_pfps; | 188 | private float m_pfps; |
193 | 189 | ||
194 | /// <summary> | 190 | /// <summary> |
@@ -208,14 +204,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
208 | private int m_physicsMS; | 204 | private int m_physicsMS; |
209 | private int m_imageMS; | 205 | private int m_imageMS; |
210 | private int m_otherMS; | 206 | private int m_otherMS; |
211 | <<<<<<< HEAD | ||
212 | private int m_scriptMS; | ||
213 | ======= | ||
214 | private int m_sleeptimeMS; | 207 | private int m_sleeptimeMS; |
215 | 208 | ||
216 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. | 209 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. |
217 | //Ckrinke private int m_scriptMS = 0; | 210 | //Ckrinke private int m_scriptMS = 0; |
218 | >>>>>>> avn/ubitvar | ||
219 | 211 | ||
220 | private int m_rootAgents; | 212 | private int m_rootAgents; |
221 | private int m_childAgents; | 213 | private int m_childAgents; |
@@ -269,27 +261,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
269 | 261 | ||
270 | private IEstateModule estateModule; | 262 | private IEstateModule estateModule; |
271 | 263 | ||
272 | public SimStatsReporter(Scene scene) | 264 | public SimStatsReporter(Scene scene) |
273 | : this(scene, Scene.m_defaultNumberFramesStored) | ||
274 | { | 265 | { |
275 | } | ||
276 | |||
277 | public SimStatsReporter(Scene scene, int numberOfFrames) | ||
278 | { | ||
279 | // Store the number of frames from the OpenSim.ini configuration file | ||
280 | m_numberFramesStored = numberOfFrames; | ||
281 | |||
282 | // Initialize the different frame time arrays to the correct sizes | ||
283 | m_totalFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
284 | m_simulationFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
285 | m_physicsFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
286 | m_networkFrameTimeMilliseconds = new double[m_numberFramesStored]; | ||
287 | |||
288 | // Initialize the current number of users logging into the region | ||
289 | m_usersLoggingIn = 0; | ||
290 | |||
291 | m_scene = scene; | 266 | m_scene = scene; |
292 | m_reportedFpsCorrectionFactor = scene.MinFrameSeconds * m_nominalReportedFps; | 267 | m_reportedFpsCorrectionFactor = scene.MinFrameTime * m_nominalReportedFps; |
293 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); | 268 | m_statsUpdateFactor = (float)(m_statsUpdatesEveryMS / 1000); |
294 | ReportingRegion = scene.RegionInfo; | 269 | ReportingRegion = scene.RegionInfo; |
295 | 270 | ||
@@ -304,7 +279,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
304 | 279 | ||
305 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit | 280 | /// At the moment, we'll only report if a frame is over 120% of target, since commonly frames are a bit |
306 | /// longer than ideal (which in itself is a concern). | 281 | /// longer than ideal (which in itself is a concern). |
307 | SlowFramesStatReportThreshold = (int)Math.Ceiling(scene.MinFrameTicks * 1.2); | 282 | SlowFramesStatReportThreshold = (int)Math.Ceiling(m_scene.MinFrameTime * 1000 * 1.2); |
308 | 283 | ||
309 | SlowFramesStat | 284 | SlowFramesStat |
310 | = new Stat( | 285 | = new Stat( |
@@ -319,7 +294,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
319 | StatVerbosity.Info); | 294 | StatVerbosity.Info); |
320 | 295 | ||
321 | StatsManager.RegisterStat(SlowFramesStat); | 296 | StatsManager.RegisterStat(SlowFramesStat); |
322 | |||
323 | } | 297 | } |
324 | 298 | ||
325 | 299 | ||
@@ -356,25 +330,10 @@ namespace OpenSim.Region.Framework.Scenes | |||
356 | 330 | ||
357 | private void statsHeartBeat(object sender, EventArgs e) | 331 | private void statsHeartBeat(object sender, EventArgs e) |
358 | { | 332 | { |
359 | double totalSumFrameTime; | 333 | if (!m_scene.Active) |
360 | double simulationSumFrameTime; | ||
361 | double physicsSumFrameTime; | ||
362 | double networkSumFrameTime; | ||
363 | float frameDilation; | ||
364 | int currentFrame; | ||
365 | |||
366 | if (!m_scene.Active) | ||
367 | return; | 334 | return; |
368 | 335 | ||
369 | <<<<<<< HEAD | ||
370 | // Create arrays to hold the statistics for this current scene, | ||
371 | // these will be passed to the SimExtraStatsCollector, they are also | ||
372 | // sent to the SimStats class | ||
373 | SimStatsPacket.StatBlock[] sb = new | ||
374 | SimStatsPacket.StatBlock[m_statisticArraySize]; | ||
375 | ======= | ||
376 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; | 336 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; |
377 | >>>>>>> avn/ubitvar | ||
378 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 337 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
379 | 338 | ||
380 | // Know what's not thread safe in Mono... modifying timers. | 339 | // Know what's not thread safe in Mono... modifying timers. |
@@ -409,9 +368,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
409 | 368 | ||
410 | // ORIGINAL code commented out until we have time to add our own | 369 | // ORIGINAL code commented out until we have time to add our own |
411 | // statistics to the statistics window | 370 | // statistics to the statistics window |
412 | //float physfps = ((m_pfps / 1000)); | 371 | float physfps = ((m_pfps / 1000)); |
413 | float physfps = m_numberPhysicsFrames; | 372 | |
414 | |||
415 | //if (physfps > 600) | 373 | //if (physfps > 600) |
416 | //physfps = physfps - (physfps - 600); | 374 | //physfps = physfps - (physfps - 600); |
417 | 375 | ||
@@ -465,61 +423,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
465 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; | 423 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; |
466 | // m_imageMS m_netMS are not included in m_frameMS | 424 | // m_imageMS m_netMS are not included in m_frameMS |
467 | 425 | ||
468 | <<<<<<< HEAD | ||
469 | uint thisFrame = m_scene.Frame; | ||
470 | uint numFrames = thisFrame - m_lastUpdateFrame; | ||
471 | float framesUpdated = (float)numFrames * m_reportedFpsCorrectionFactor; | ||
472 | m_lastUpdateFrame = thisFrame; | ||
473 | |||
474 | // Avoid div-by-zero if somehow we've not updated any frames. | ||
475 | if (framesUpdated == 0) | ||
476 | framesUpdated = 1; | ||
477 | |||
478 | for (int i = 0; i < m_statisticArraySize; i++) | ||
479 | ======= | ||
480 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; | 426 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; |
481 | if (m_otherMS < 0) | 427 | if (m_otherMS < 0) |
482 | m_otherMS = 0; | 428 | m_otherMS = 0; |
483 | 429 | ||
484 | for (int i = 0; i < 23; i++) | 430 | for (int i = 0; i < 23; i++) |
485 | >>>>>>> avn/ubitvar | ||
486 | { | 431 | { |
487 | sb[i] = new SimStatsPacket.StatBlock(); | 432 | sb[i] = new SimStatsPacket.StatBlock(); |
488 | } | 433 | } |
489 | 434 | ||
490 | // Resetting the sums of the frame times to prevent any errors | 435 | |
491 | // in calculating the moving average for frame time | ||
492 | totalSumFrameTime = 0; | ||
493 | simulationSumFrameTime = 0; | ||
494 | physicsSumFrameTime = 0; | ||
495 | networkSumFrameTime = 0; | ||
496 | |||
497 | // Loop through all the frames that were stored for the current | ||
498 | // heartbeat to process the moving average of frame times | ||
499 | for (int i = 0; i < m_numberFramesStored; i++) | ||
500 | { | ||
501 | // Sum up each frame time in order to calculate the moving | ||
502 | // average of frame time | ||
503 | totalSumFrameTime += m_totalFrameTimeMilliseconds[i]; | ||
504 | simulationSumFrameTime += | ||
505 | m_simulationFrameTimeMilliseconds[i]; | ||
506 | physicsSumFrameTime += m_physicsFrameTimeMilliseconds[i]; | ||
507 | networkSumFrameTime += m_networkFrameTimeMilliseconds[i]; | ||
508 | } | ||
509 | |||
510 | // Get the index that represents the current frame based on the next one known; go back | ||
511 | // to the last index if next one is stated to restart at 0 | ||
512 | if (m_nextLocation == 0) | ||
513 | currentFrame = m_numberFramesStored - 1; | ||
514 | else | ||
515 | currentFrame = m_nextLocation - 1; | ||
516 | |||
517 | // Calculate the frame dilation; which is currently based on the ratio between the sum of the | ||
518 | // physics and simulation rate, and the set minimum time to run a scene's frame | ||
519 | frameDilation = (float)(m_simulationFrameTimeMilliseconds[currentFrame] + | ||
520 | m_physicsFrameTimeMilliseconds[currentFrame]) / m_scene.MinFrameTicks; | ||
521 | |||
522 | // ORIGINAL code commented out until we have time to add our own | ||
523 | sb[0].StatID = (uint) Stats.TimeDilation; | 436 | sb[0].StatID = (uint) Stats.TimeDilation; |
524 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 437 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); |
525 | 438 | ||
@@ -544,21 +457,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
544 | sb[7].StatID = (uint) Stats.ActivePrim; | 457 | sb[7].StatID = (uint) Stats.ActivePrim; |
545 | sb[7].StatValue = m_activePrim; | 458 | sb[7].StatValue = m_activePrim; |
546 | 459 | ||
547 | // ORIGINAL code commented out until we have time to add our own | ||
548 | // statistics to the statistics window | ||
549 | sb[8].StatID = (uint)Stats.FrameMS; | 460 | sb[8].StatID = (uint)Stats.FrameMS; |
550 | <<<<<<< HEAD | ||
551 | //sb[8].StatValue = m_frameMS / framesUpdated; | ||
552 | sb[8].StatValue = (float) totalSumFrameTime / m_numberFramesStored; | ||
553 | |||
554 | sb[9].StatID = (uint)Stats.NetMS; | ||
555 | //sb[9].StatValue = m_netMS / framesUpdated; | ||
556 | sb[9].StatValue = (float) networkSumFrameTime / m_numberFramesStored; | ||
557 | |||
558 | sb[10].StatID = (uint)Stats.PhysicsMS; | ||
559 | //sb[10].StatValue = m_physicsMS / framesUpdated; | ||
560 | sb[10].StatValue = (float) physicsSumFrameTime / m_numberFramesStored; | ||
561 | ======= | ||
562 | sb[8].StatValue = TotalFrameTime; | 461 | sb[8].StatValue = TotalFrameTime; |
563 | 462 | ||
564 | sb[9].StatID = (uint)Stats.NetMS; | 463 | sb[9].StatID = (uint)Stats.NetMS; |
@@ -566,18 +465,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
566 | 465 | ||
567 | sb[10].StatID = (uint)Stats.PhysicsMS; | 466 | sb[10].StatID = (uint)Stats.PhysicsMS; |
568 | sb[10].StatValue = m_physicsMS * perframe; | 467 | sb[10].StatValue = m_physicsMS * perframe; |
569 | >>>>>>> avn/ubitvar | ||
570 | 468 | ||
571 | sb[11].StatID = (uint)Stats.ImageMS ; | 469 | sb[11].StatID = (uint)Stats.ImageMS ; |
572 | sb[11].StatValue = m_imageMS * perframe; | 470 | sb[11].StatValue = m_imageMS * perframe; |
573 | 471 | ||
574 | sb[12].StatID = (uint)Stats.OtherMS; | 472 | sb[12].StatID = (uint)Stats.OtherMS; |
575 | <<<<<<< HEAD | ||
576 | //sb[12].StatValue = m_otherMS / framesUpdated; | ||
577 | sb[12].StatValue = (float) simulationSumFrameTime / m_numberFramesStored; | ||
578 | ======= | ||
579 | sb[12].StatValue = m_otherMS * perframe; | 473 | sb[12].StatValue = m_otherMS * perframe; |
580 | >>>>>>> avn/ubitvar | ||
581 | 474 | ||
582 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 475 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
583 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); | 476 | sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); |
@@ -609,30 +502,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
609 | sb[22].StatID = (uint)Stats.SimSleepMs; | 502 | sb[22].StatID = (uint)Stats.SimSleepMs; |
610 | sb[22].StatValue = sleeptime; | 503 | sb[22].StatValue = sleeptime; |
611 | 504 | ||
612 | // Current ratio between the sum of physics and sim rate, and the | ||
613 | // minimum time to run a scene's frame | ||
614 | sb[22].StatID = (uint)Stats.FrameDilation; | ||
615 | sb[22].StatValue = frameDilation; | ||
616 | |||
617 | // Current number of users currently attemptint to login to region | ||
618 | sb[23].StatID = (uint)Stats.UsersLoggingIn; | ||
619 | sb[23].StatValue = m_usersLoggingIn; | ||
620 | |||
621 | // Total number of geometric primitives in the scene | ||
622 | sb[24].StatID = (uint)Stats.TotalGeoPrim; | ||
623 | sb[24].StatValue = m_numGeoPrim; | ||
624 | |||
625 | // Total number of mesh objects in the scene | ||
626 | sb[25].StatID = (uint)Stats.TotalMesh; | ||
627 | sb[25].StatValue = m_numMesh; | ||
628 | |||
629 | // Current number of threads that XEngine is using | ||
630 | sb[26].StatID = (uint)Stats.ThreadCount; | ||
631 | sb[26].StatValue = m_inUseThreads; | ||
632 | |||
633 | sb[27].StatID = (uint)Stats.ScriptMS; | ||
634 | sb[27].StatValue = (numFrames <= 0) ? 0 : ((float)m_scriptMS / numFrames); | ||
635 | |||
636 | for (int i = 0; i < m_statisticArraySize; i++) | 505 | for (int i = 0; i < m_statisticArraySize; i++) |
637 | { | 506 | { |
638 | lastReportedSimStats[i] = sb[i].StatValue; | 507 | lastReportedSimStats[i] = sb[i].StatValue; |
@@ -702,16 +571,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
702 | m_physicsMS = 0; | 571 | m_physicsMS = 0; |
703 | m_imageMS = 0; | 572 | m_imageMS = 0; |
704 | m_otherMS = 0; | 573 | m_otherMS = 0; |
705 | <<<<<<< HEAD | ||
706 | m_scriptMS = 0; | ||
707 | m_spareMS = 0; | ||
708 | ======= | ||
709 | // m_spareMS = 0; | 574 | // m_spareMS = 0; |
710 | m_sleeptimeMS = 0; | 575 | m_sleeptimeMS = 0; |
711 | 576 | ||
712 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 577 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
713 | //Ckrinke m_scriptMS = 0; | 578 | //Ckrinke m_scriptMS = 0; |
714 | >>>>>>> avn/ubitvar | ||
715 | } | 579 | } |
716 | 580 | ||
717 | # region methods called from Scene | 581 | # region methods called from Scene |
@@ -817,41 +681,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
817 | m_otherMS += ms; | 681 | m_otherMS += ms; |
818 | } | 682 | } |
819 | 683 | ||
820 | <<<<<<< HEAD | ||
821 | public void AddScriptMS(int ms) | ||
822 | { | ||
823 | m_scriptMS += ms; | ||
824 | } | ||
825 | |||
826 | public void addPhysicsFrame(int frames) | ||
827 | { | ||
828 | // Add the number of physics frames to the correct total physics | ||
829 | // frames | ||
830 | m_numberPhysicsFrames += frames; | ||
831 | } | ||
832 | |||
833 | public void addFrameTimeMilliseconds(double total, double simulation, | ||
834 | double physics, double network) | ||
835 | { | ||
836 | // Save the frame times from the current frame into the appropriate | ||
837 | // arrays | ||
838 | m_totalFrameTimeMilliseconds[m_nextLocation] = total; | ||
839 | m_simulationFrameTimeMilliseconds[m_nextLocation] = simulation; | ||
840 | m_physicsFrameTimeMilliseconds[m_nextLocation] = physics; | ||
841 | m_networkFrameTimeMilliseconds[m_nextLocation] = network; | ||
842 | |||
843 | // Update to the next location in the list | ||
844 | m_nextLocation++; | ||
845 | |||
846 | // Since the list will begin to overwrite the oldest frame values | ||
847 | // first, the next location needs to loop back to the beginning of the | ||
848 | // list whenever it reaches the end | ||
849 | m_nextLocation = m_nextLocation % m_numberFramesStored; | ||
850 | ======= | ||
851 | public void addSleepMS(int ms) | 684 | public void addSleepMS(int ms) |
852 | { | 685 | { |
853 | m_sleeptimeMS += ms; | 686 | m_sleeptimeMS += ms; |
854 | >>>>>>> avn/ubitvar | ||
855 | } | 687 | } |
856 | 688 | ||
857 | public void AddPendingDownloads(int count) | 689 | public void AddPendingDownloads(int count) |