aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xOpenSim/Region/Framework/Scenes/SimStatsReporter.cs141
1 files changed, 91 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index b964317..462e8a6 100755
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -63,10 +63,9 @@ namespace OpenSim.Region.Framework.Scenes
63 63
64 // Determines the size of the array that is used to collect StatBlocks 64 // Determines the size of the array that is used to collect StatBlocks
65 // for sending viewer compatible stats must be conform with sb array filling below 65 // for sending viewer compatible stats must be conform with sb array filling below
66 private const int m_statisticViewerArraySize = 23; 66 private const int m_statisticViewerArraySize = 37;
67 // size of LastReportedSimFPS with extra stats. 67 // size of LastReportedSimFPS with extra stats.
68 private const int m_statisticExtraArraySize = m_statisticViewerArraySize + 68 private const int m_statisticExtraArraySize = (int)(Stats.SimExtraCountEnd - Stats.SimExtraCountStart);
69 (int)(Stats.SimExtraCountEnd - Stats.SimExtraCountStart);
70 69
71 /// <summary> 70 /// <summary>
72 /// These are the IDs of stats sent in the StatsPacket to the viewer. 71 /// These are the IDs of stats sent in the StatsPacket to the viewer.
@@ -196,7 +195,7 @@ namespace OpenSim.Region.Framework.Scenes
196 195
197 // saved last reported value so there is something available for llGetRegionFPS 196 // saved last reported value so there is something available for llGetRegionFPS
198 private float lastReportedSimFPS; 197 private float lastReportedSimFPS;
199 private float[] lastReportedSimStats = new float[m_statisticExtraArraySize]; 198 private float[] lastReportedSimStats = new float[m_statisticExtraArraySize + m_statisticViewerArraySize];
200 private float m_pfps; 199 private float m_pfps;
201 200
202 /// <summary> 201 /// <summary>
@@ -234,28 +233,7 @@ namespace OpenSim.Region.Framework.Scenes
234 233
235 private int m_objectCapacity = 45000; 234 private int m_objectCapacity = 45000;
236 235
237 // This is the number of frames that will be stored and then averaged for 236 // The current number of users attempting to login to the region
238 // the Total, Simulation, Physics, and Network Frame Time; It is set to
239 // 10 by default but can be changed by the OpenSim.ini configuration file
240 // NumberOfFrames parameter
241 private int m_numberFramesStored;
242
243 // The arrays that will hold the time it took to run the past N frames,
244 // where N is the num_frames_to_average given by the configuration file
245 private double[] m_totalFrameTimeMilliseconds;
246 private double[] m_simulationFrameTimeMilliseconds;
247 private double[] m_physicsFrameTimeMilliseconds;
248 private double[] m_networkFrameTimeMilliseconds;
249
250 // The location of the next time in milliseconds that will be
251 // (over)written when the next frame completes
252 private int m_nextLocation = 0;
253
254 // The correct number of frames that have completed since the last stats
255 // update for physics
256 private int m_numberPhysicsFrames;
257
258 // The current number of users attempting to login to the region
259 private int m_usersLoggingIn; 237 private int m_usersLoggingIn;
260 238
261 // The last reported value of threads from the SmartThreadPool inside of 239 // The last reported value of threads from the SmartThreadPool inside of
@@ -339,18 +317,12 @@ namespace OpenSim.Region.Framework.Scenes
339 317
340 private void statsHeartBeat(object sender, EventArgs e) 318 private void statsHeartBeat(object sender, EventArgs e)
341 { 319 {
342 double totalSumFrameTime; 320 if (!m_scene.Active)
343 double simulationSumFrameTime;
344 double physicsSumFrameTime;
345 double networkSumFrameTime;
346 float frameDilation;
347 int currentFrame;
348
349 if (!m_scene.Active)
350 return; 321 return;
351 322
352 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[m_statisticViewerArraySize]; 323 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[m_statisticViewerArraySize];
353 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 324 SimStatsPacket.StatBlock[] sbex = new SimStatsPacket.StatBlock[m_statisticExtraArraySize];
325 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
354 326
355 // Know what's not thread safe in Mono... modifying timers. 327 // Know what's not thread safe in Mono... modifying timers.
356 // m_log.Debug("Firing Stats Heart Beat"); 328 // m_log.Debug("Firing Stats Heart Beat");
@@ -431,7 +403,7 @@ namespace OpenSim.Region.Framework.Scenes
431 if (m_otherMS < 0) 403 if (m_otherMS < 0)
432 m_otherMS = 0; 404 m_otherMS = 0;
433 405
434 for (int i = 0; i < 23; i++) 406 for (int i = 0; i < m_statisticViewerArraySize; i++)
435 { 407 {
436 sb[i] = new SimStatsPacket.StatBlock(); 408 sb[i] = new SimStatsPacket.StatBlock();
437 } 409 }
@@ -506,25 +478,95 @@ namespace OpenSim.Region.Framework.Scenes
506 sb[22].StatID = (uint)Stats.SimPhysicsStepMs; 478 sb[22].StatID = (uint)Stats.SimPhysicsStepMs;
507 sb[22].StatValue = 20; 479 sb[22].StatValue = 20;
508 480
509 for (int i = 0; i < 23; i++) 481 // send the ones we dont have as zeros, to clean viewers state
482 // specially arriving from regions with wrond IDs in use
483
484 sb[23].StatID = (uint)Stats.VirtualSizeKb;
485 sb[23].StatValue = 0;
486
487 sb[24].StatID = (uint)Stats.ResidentSizeKb;
488 sb[24].StatValue = 0;
489
490 sb[25].StatID = (uint)Stats.PendingLocalUploads;
491 sb[25].StatValue = 0;
492
493 sb[26].StatID = (uint)Stats.PhysicsPinnedTasks;
494 sb[26].StatValue = 0;
495
496 sb[27].StatID = (uint)Stats.PhysicsLodTasks;
497 sb[27].StatValue = 0;
498
499 sb[28].StatID = (uint)Stats.ScriptEps; // we should have this
500 sb[28].StatValue = 0;
501
502 sb[29].StatID = (uint)Stats.SimAIStepTimeMS;
503 sb[29].StatValue = 0;
504
505 sb[30].StatID = (uint)Stats.SimIoPumpTime;
506 sb[30].StatValue = 0;
507
508 sb[31].StatID = (uint)Stats.SimPCTSscriptsRun;
509 sb[31].StatValue = 0;
510
511 sb[32].StatID = (uint)Stats.SimRegionIdle;
512 sb[32].StatValue = 0;
513
514 sb[33].StatID = (uint)Stats.SimRegionIdlePossible;
515 sb[33].StatValue = 0;
516
517 sb[34].StatID = (uint)Stats.SimSkippedSillouet_PS;
518 sb[34].StatValue = 0;
519
520 sb[35].StatID = (uint)Stats.SimSkippedCharsPerC;
521 sb[35].StatValue = 0;
522
523 sb[36].StatID = (uint)Stats.SimPhysicsMemory;
524 sb[36].StatValue = 0;
525
526
527 for (int i = 0; i < 37; i++)
510 { 528 {
511 lastReportedSimStats[i] = sb[i].StatValue; 529 lastReportedSimStats[i] = sb[i].StatValue;
512 } 530 }
513 531
532
533 // add extra stats for internal use
534
535 for (int i = 0; i < m_statisticExtraArraySize; i++)
536 {
537 sbex[i] = new SimStatsPacket.StatBlock();
538 }
539
540 sbex[0].StatID = (uint)Stats.LSLScriptLinesPerSecond;
541 sbex[0].StatValue = m_scriptLinesPerSecond * updateFactor;
542 lastReportedSimStats[37] = m_scriptLinesPerSecond * updateFactor;
543
544 sbex[1].StatID = (uint)Stats.FrameDilation2;
545 sbex[1].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation;
546 lastReportedSimStats[38] = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation;
547
548 sbex[2].StatID = (uint)Stats.UsersLoggingIn;
549 sbex[2].StatValue = m_usersLoggingIn;
550 lastReportedSimStats[39] = m_usersLoggingIn;
551
552 sbex[3].StatID = (uint)Stats.TotalGeoPrim;
553 sbex[3].StatValue = m_numGeoPrim;
554 lastReportedSimStats[40] = m_numGeoPrim;
555
556 sbex[4].StatID = (uint)Stats.TotalMesh;
557 sbex[4].StatValue = m_numMesh;
558 lastReportedSimStats[41] = m_numMesh;
559
560 sbex[5].StatID = (uint)Stats.ThreadCount;
561 sbex[5].StatValue = m_inUseThreads;
562 lastReportedSimStats[42] = m_inUseThreads;
563
514 SimStats simStats 564 SimStats simStats
515 = new SimStats( 565 = new SimStats(
516 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, 566 ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity,
517 rb, sb, m_scene.RegionInfo.originRegionID); 567 rb, sb, sbex, m_scene.RegionInfo.originRegionID);
518 568
519 // add extra stats for internal use 569 handlerSendStatResult = OnSendStatsResult;
520 lastReportedSimStats[23] = m_scriptLinesPerSecond * updateFactor;
521 lastReportedSimStats[24] = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation;
522 lastReportedSimStats[24] = m_usersLoggingIn;
523 lastReportedSimStats[25] = m_numGeoPrim;
524 lastReportedSimStats[26] = m_numMesh;
525 lastReportedSimStats[27] = m_inUseThreads;
526
527 handlerSendStatResult = OnSendStatsResult;
528 if (handlerSendStatResult != null) 570 if (handlerSendStatResult != null)
529 { 571 {
530 handlerSendStatResult(simStats); 572 handlerSendStatResult(simStats);
@@ -565,7 +607,6 @@ namespace OpenSim.Region.Framework.Scenes
565 { 607 {
566 // Reset the number of frames that the physics library has 608 // Reset the number of frames that the physics library has
567 // processed since the last stats report 609 // processed since the last stats report
568 m_numberPhysicsFrames = 0;
569 610
570 m_timeDilation = 0; 611 m_timeDilation = 0;
571 m_fps = 0; 612 m_fps = 0;