diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SimStatsReporter.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 97 |
1 files changed, 78 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 87af311..0efe4c4 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -83,7 +83,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
83 | OutPacketsPerSecond = 18, | 83 | OutPacketsPerSecond = 18, |
84 | PendingDownloads = 19, | 84 | PendingDownloads = 19, |
85 | PendingUploads = 20, | 85 | PendingUploads = 20, |
86 | VirtualSizeKB = 21, | ||
87 | ResidentSizeKB = 22, | ||
88 | PendingLocalUploads = 23, | ||
86 | UnAckedBytes = 24, | 89 | UnAckedBytes = 24, |
90 | PhysicsPinnedTasks = 25, | ||
91 | PhysicsLODTasks = 26, | ||
92 | PhysicsStepMS = 27, | ||
93 | PhysicsShapeMS = 28, | ||
94 | PhysicsOtherMS = 29, | ||
95 | PhysicsMemory = 30, | ||
96 | ScriptEPS = 31, | ||
97 | SimSpareTime = 32, | ||
98 | SimSleepTime = 33, | ||
99 | IOPumpTime = 34 | ||
87 | } | 100 | } |
88 | 101 | ||
89 | /// <summary> | 102 | /// <summary> |
@@ -139,7 +152,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
139 | 152 | ||
140 | // saved last reported value so there is something available for llGetRegionFPS | 153 | // saved last reported value so there is something available for llGetRegionFPS |
141 | private float lastReportedSimFPS = 0; | 154 | private float lastReportedSimFPS = 0; |
142 | private float[] lastReportedSimStats = new float[21]; | 155 | private float[] lastReportedSimStats = new float[23]; |
143 | private float m_pfps = 0; | 156 | private float m_pfps = 0; |
144 | 157 | ||
145 | /// <summary> | 158 | /// <summary> |
@@ -158,6 +171,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
158 | private int m_physicsMS = 0; | 171 | private int m_physicsMS = 0; |
159 | private int m_imageMS = 0; | 172 | private int m_imageMS = 0; |
160 | private int m_otherMS = 0; | 173 | private int m_otherMS = 0; |
174 | private int m_sleeptimeMS = 0; | ||
175 | |||
161 | 176 | ||
162 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. | 177 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. |
163 | //Ckrinke private int m_scriptMS = 0; | 178 | //Ckrinke private int m_scriptMS = 0; |
@@ -220,7 +235,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
220 | 235 | ||
221 | private void statsHeartBeat(object sender, EventArgs e) | 236 | private void statsHeartBeat(object sender, EventArgs e) |
222 | { | 237 | { |
223 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21]; | 238 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; |
224 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 239 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
225 | 240 | ||
226 | // Know what's not thread safe in Mono... modifying timers. | 241 | // Know what's not thread safe in Mono... modifying timers. |
@@ -258,6 +273,33 @@ namespace OpenSim.Region.Framework.Scenes | |||
258 | physfps = 0; | 273 | physfps = 0; |
259 | 274 | ||
260 | #endregion | 275 | #endregion |
276 | float factor = 1 / statsUpdateFactor; | ||
277 | if (reportedFPS <= 0) | ||
278 | reportedFPS = 1; | ||
279 | |||
280 | float perframe = 1.0f / (float)reportedFPS; | ||
281 | |||
282 | float TotalFrameTime = m_frameMS * perframe; | ||
283 | |||
284 | float targetframetime = 1100.0f / (float)m_nominalReportedFps; | ||
285 | |||
286 | float sparetime; | ||
287 | float sleeptime; | ||
288 | if (TotalFrameTime > targetframetime) | ||
289 | { | ||
290 | sparetime = 0; | ||
291 | sleeptime = 0; | ||
292 | } | ||
293 | else | ||
294 | { | ||
295 | sparetime = m_frameMS - m_physicsMS - m_agentMS; | ||
296 | sparetime *= perframe; | ||
297 | if (sparetime < 0) | ||
298 | sparetime = 0; | ||
299 | else if (sparetime > TotalFrameTime) | ||
300 | sparetime = TotalFrameTime; | ||
301 | sleeptime = m_sleeptimeMS * perframe; | ||
302 | } | ||
261 | 303 | ||
262 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); | 304 | m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); |
263 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); | 305 | m_childAgents = m_scene.SceneGraph.GetChildAgentCount(); |
@@ -269,17 +311,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
269 | // so that stat numbers are always consistent. | 311 | // so that stat numbers are always consistent. |
270 | CheckStatSanity(); | 312 | CheckStatSanity(); |
271 | 313 | ||
272 | //Our time dilation is 0.91 when we're running a full speed, | 314 | // other MS is actually simulation time |
273 | // therefore to make sure we get an appropriate range, | 315 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; |
274 | // we have to factor in our error. (0.10f * statsUpdateFactor) | 316 | // m_imageMS m_netMS are not included in m_frameMS |
275 | // multiplies the fix for the error times the amount of times it'll occur a second | ||
276 | // / 10 divides the value by the number of times the sim heartbeat runs (10fps) | ||
277 | // Then we divide the whole amount by the amount of seconds pass in between stats updates. | ||
278 | 317 | ||
279 | // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change | 318 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; |
280 | // values to X-per-second values. | 319 | if (m_otherMS < 0) |
320 | m_otherMS = 0; | ||
281 | 321 | ||
282 | for (int i = 0; i < 21; i++) | 322 | for (int i = 0; i < 23; i++) |
283 | { | 323 | { |
284 | sb[i] = new SimStatsPacket.StatBlock(); | 324 | sb[i] = new SimStatsPacket.StatBlock(); |
285 | } | 325 | } |
@@ -309,19 +349,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
309 | sb[7].StatValue = m_activePrim; | 349 | sb[7].StatValue = m_activePrim; |
310 | 350 | ||
311 | sb[8].StatID = (uint)Stats.FrameMS; | 351 | sb[8].StatID = (uint)Stats.FrameMS; |
312 | sb[8].StatValue = m_frameMS / statsUpdateFactor; | 352 | // sb[8].StatValue = m_frameMS / statsUpdateFactor; |
353 | sb[8].StatValue = TotalFrameTime; | ||
313 | 354 | ||
314 | sb[9].StatID = (uint)Stats.NetMS; | 355 | sb[9].StatID = (uint)Stats.NetMS; |
315 | sb[9].StatValue = m_netMS / statsUpdateFactor; | 356 | // sb[9].StatValue = m_netMS / statsUpdateFactor; |
357 | sb[9].StatValue = m_netMS * perframe; | ||
316 | 358 | ||
317 | sb[10].StatID = (uint)Stats.PhysicsMS; | 359 | sb[10].StatID = (uint)Stats.PhysicsMS; |
318 | sb[10].StatValue = m_physicsMS / statsUpdateFactor; | 360 | // sb[10].StatValue = m_physicsMS / statsUpdateFactor; |
361 | sb[10].StatValue = m_physicsMS * perframe; | ||
319 | 362 | ||
320 | sb[11].StatID = (uint)Stats.ImageMS ; | 363 | sb[11].StatID = (uint)Stats.ImageMS ; |
321 | sb[11].StatValue = m_imageMS / statsUpdateFactor; | 364 | // sb[11].StatValue = m_imageMS / statsUpdateFactor; |
365 | sb[11].StatValue = m_imageMS * perframe; | ||
322 | 366 | ||
323 | sb[12].StatID = (uint)Stats.OtherMS; | 367 | sb[12].StatID = (uint)Stats.OtherMS; |
324 | sb[12].StatValue = m_otherMS / statsUpdateFactor; | 368 | // sb[12].StatValue = m_otherMS / statsUpdateFactor; |
369 | sb[12].StatValue = m_otherMS * perframe; | ||
370 | |||
325 | 371 | ||
326 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 372 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
327 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); | 373 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); |
@@ -333,7 +379,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
333 | sb[15].StatValue = m_unAckedBytes; | 379 | sb[15].StatValue = m_unAckedBytes; |
334 | 380 | ||
335 | sb[16].StatID = (uint)Stats.AgentMS; | 381 | sb[16].StatID = (uint)Stats.AgentMS; |
336 | sb[16].StatValue = m_agentMS / statsUpdateFactor; | 382 | // sb[16].StatValue = m_agentMS / statsUpdateFactor; |
383 | sb[16].StatValue = m_agentMS * perframe; | ||
337 | 384 | ||
338 | sb[17].StatID = (uint)Stats.PendingDownloads; | 385 | sb[17].StatID = (uint)Stats.PendingDownloads; |
339 | sb[17].StatValue = m_pendingDownloads; | 386 | sb[17].StatValue = m_pendingDownloads; |
@@ -346,8 +393,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
346 | 393 | ||
347 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; | 394 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; |
348 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; | 395 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; |
349 | 396 | ||
350 | for (int i = 0; i < 21; i++) | 397 | sb[21].StatID = (uint)Stats.SimSpareTime; |
398 | sb[21].StatValue = sparetime; | ||
399 | |||
400 | sb[22].StatID = (uint)Stats.SimSleepTime; | ||
401 | sb[22].StatValue = sleeptime; | ||
402 | |||
403 | for (int i = 0; i < 23; i++) | ||
351 | { | 404 | { |
352 | lastReportedSimStats[i] = sb[i].StatValue; | 405 | lastReportedSimStats[i] = sb[i].StatValue; |
353 | } | 406 | } |
@@ -401,6 +454,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
401 | m_physicsMS = 0; | 454 | m_physicsMS = 0; |
402 | m_imageMS = 0; | 455 | m_imageMS = 0; |
403 | m_otherMS = 0; | 456 | m_otherMS = 0; |
457 | m_sleeptimeMS = 0; | ||
404 | 458 | ||
405 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 459 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
406 | //Ckrinke m_scriptMS = 0; | 460 | //Ckrinke m_scriptMS = 0; |
@@ -504,6 +558,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
504 | m_otherMS += ms; | 558 | m_otherMS += ms; |
505 | } | 559 | } |
506 | 560 | ||
561 | public void addSleepMS(int ms) | ||
562 | { | ||
563 | m_sleeptimeMS += ms; | ||
564 | } | ||
565 | |||
507 | public void AddPendingDownloads(int count) | 566 | public void AddPendingDownloads(int count) |
508 | { | 567 | { |
509 | m_pendingDownloads += count; | 568 | m_pendingDownloads += count; |