diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/SimStatsReporter.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 92 |
1 files changed, 73 insertions, 19 deletions
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 5c56264..94f1b15 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -75,7 +75,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
75 | OutPacketsPerSecond = 18, | 75 | OutPacketsPerSecond = 18, |
76 | PendingDownloads = 19, | 76 | PendingDownloads = 19, |
77 | PendingUploads = 20, | 77 | PendingUploads = 20, |
78 | VirtualSizeKB = 21, | ||
79 | ResidentSizeKB = 22, | ||
80 | PendingLocalUploads = 23, | ||
78 | UnAckedBytes = 24, | 81 | UnAckedBytes = 24, |
82 | PhysicsPinnedTasks = 25, | ||
83 | PhysicsLODTasks = 26, | ||
84 | PhysicsStepMS = 27, | ||
85 | PhysicsShapeMS = 28, | ||
86 | PhysicsOtherMS = 29, | ||
87 | PhysicsMemory = 30, | ||
88 | ScriptEPS = 31, | ||
89 | SimSpareTime = 32, | ||
90 | SimSleepTime = 33, | ||
91 | IOPumpTime = 34 | ||
79 | } | 92 | } |
80 | 93 | ||
81 | /// <summary> | 94 | /// <summary> |
@@ -123,7 +136,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
123 | 136 | ||
124 | // saved last reported value so there is something available for llGetRegionFPS | 137 | // saved last reported value so there is something available for llGetRegionFPS |
125 | private float lastReportedSimFPS = 0; | 138 | private float lastReportedSimFPS = 0; |
126 | private float[] lastReportedSimStats = new float[21]; | 139 | private float[] lastReportedSimStats = new float[23]; |
127 | private float m_pfps = 0; | 140 | private float m_pfps = 0; |
128 | 141 | ||
129 | /// <summary> | 142 | /// <summary> |
@@ -142,6 +155,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
142 | private int m_physicsMS = 0; | 155 | private int m_physicsMS = 0; |
143 | private int m_imageMS = 0; | 156 | private int m_imageMS = 0; |
144 | private int m_otherMS = 0; | 157 | private int m_otherMS = 0; |
158 | private int m_sleeptimeMS = 0; | ||
159 | |||
145 | 160 | ||
146 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. | 161 | //Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. |
147 | //Ckrinke private int m_scriptMS = 0; | 162 | //Ckrinke private int m_scriptMS = 0; |
@@ -200,7 +215,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
200 | 215 | ||
201 | private void statsHeartBeat(object sender, EventArgs e) | 216 | private void statsHeartBeat(object sender, EventArgs e) |
202 | { | 217 | { |
203 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[21]; | 218 | SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23]; |
204 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); | 219 | SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); |
205 | 220 | ||
206 | // Know what's not thread safe in Mono... modifying timers. | 221 | // Know what's not thread safe in Mono... modifying timers. |
@@ -238,18 +253,38 @@ namespace OpenSim.Region.Framework.Scenes | |||
238 | physfps = 0; | 253 | physfps = 0; |
239 | 254 | ||
240 | #endregion | 255 | #endregion |
256 | float factor = 1 / statsUpdateFactor; | ||
257 | if (reportedFPS <= 0) | ||
258 | reportedFPS = 1; | ||
259 | |||
260 | float perframe = 1.0f / (float)reportedFPS; | ||
261 | |||
262 | float TotalFrameTime = m_frameMS * perframe; | ||
263 | |||
264 | float targetframetime = 1100.0f / (float)m_nominalReportedFps; | ||
265 | |||
266 | float sparetime; | ||
267 | if (TotalFrameTime > targetframetime ) | ||
268 | sparetime = 0; | ||
269 | else | ||
270 | { | ||
271 | sparetime = m_frameMS - m_physicsMS - m_agentMS; | ||
272 | sparetime *= perframe; | ||
273 | if (sparetime < 0) | ||
274 | sparetime = 0; | ||
275 | else if (sparetime > TotalFrameTime) | ||
276 | sparetime = TotalFrameTime; | ||
277 | } | ||
241 | 278 | ||
242 | //Our time dilation is 0.91 when we're running a full speed, | 279 | // other MS is actually simulation time |
243 | // therefore to make sure we get an appropriate range, | 280 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; |
244 | // we have to factor in our error. (0.10f * statsUpdateFactor) | 281 | // m_imageMS m_netMS are not included in m_frameMS |
245 | // multiplies the fix for the error times the amount of times it'll occur a second | ||
246 | // / 10 divides the value by the number of times the sim heartbeat runs (10fps) | ||
247 | // Then we divide the whole amount by the amount of seconds pass in between stats updates. | ||
248 | 282 | ||
249 | // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change | 283 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; |
250 | // values to X-per-second values. | 284 | if (m_otherMS < 0) |
285 | m_otherMS = 0; | ||
251 | 286 | ||
252 | for (int i = 0; i < 21; i++) | 287 | for (int i = 0; i < 23; i++) |
253 | { | 288 | { |
254 | sb[i] = new SimStatsPacket.StatBlock(); | 289 | sb[i] = new SimStatsPacket.StatBlock(); |
255 | } | 290 | } |
@@ -279,19 +314,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
279 | sb[7].StatValue = m_activePrim; | 314 | sb[7].StatValue = m_activePrim; |
280 | 315 | ||
281 | sb[8].StatID = (uint)Stats.FrameMS; | 316 | sb[8].StatID = (uint)Stats.FrameMS; |
282 | sb[8].StatValue = m_frameMS / statsUpdateFactor; | 317 | // sb[8].StatValue = m_frameMS / statsUpdateFactor; |
318 | sb[8].StatValue = TotalFrameTime; | ||
283 | 319 | ||
284 | sb[9].StatID = (uint)Stats.NetMS; | 320 | sb[9].StatID = (uint)Stats.NetMS; |
285 | sb[9].StatValue = m_netMS / statsUpdateFactor; | 321 | // sb[9].StatValue = m_netMS / statsUpdateFactor; |
322 | sb[9].StatValue = m_netMS * perframe; | ||
286 | 323 | ||
287 | sb[10].StatID = (uint)Stats.PhysicsMS; | 324 | sb[10].StatID = (uint)Stats.PhysicsMS; |
288 | sb[10].StatValue = m_physicsMS / statsUpdateFactor; | 325 | // sb[10].StatValue = m_physicsMS / statsUpdateFactor; |
326 | sb[10].StatValue = m_physicsMS * perframe; | ||
289 | 327 | ||
290 | sb[11].StatID = (uint)Stats.ImageMS ; | 328 | sb[11].StatID = (uint)Stats.ImageMS ; |
291 | sb[11].StatValue = m_imageMS / statsUpdateFactor; | 329 | // sb[11].StatValue = m_imageMS / statsUpdateFactor; |
330 | sb[11].StatValue = m_imageMS * perframe; | ||
292 | 331 | ||
293 | sb[12].StatID = (uint)Stats.OtherMS; | 332 | sb[12].StatID = (uint)Stats.OtherMS; |
294 | sb[12].StatValue = m_otherMS / statsUpdateFactor; | 333 | // sb[12].StatValue = m_otherMS / statsUpdateFactor; |
334 | sb[12].StatValue = m_otherMS * perframe; | ||
335 | |||
295 | 336 | ||
296 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 337 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
297 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); | 338 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); |
@@ -303,7 +344,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
303 | sb[15].StatValue = m_unAckedBytes; | 344 | sb[15].StatValue = m_unAckedBytes; |
304 | 345 | ||
305 | sb[16].StatID = (uint)Stats.AgentMS; | 346 | sb[16].StatID = (uint)Stats.AgentMS; |
306 | sb[16].StatValue = m_agentMS / statsUpdateFactor; | 347 | // sb[16].StatValue = m_agentMS / statsUpdateFactor; |
348 | sb[16].StatValue = m_agentMS * perframe; | ||
307 | 349 | ||
308 | sb[17].StatID = (uint)Stats.PendingDownloads; | 350 | sb[17].StatID = (uint)Stats.PendingDownloads; |
309 | sb[17].StatValue = m_pendingDownloads; | 351 | sb[17].StatValue = m_pendingDownloads; |
@@ -316,8 +358,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
316 | 358 | ||
317 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; | 359 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; |
318 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; | 360 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; |
319 | 361 | ||
320 | for (int i = 0; i < 21; i++) | 362 | sb[21].StatID = (uint)Stats.SimSpareTime; |
363 | sb[21].StatValue = sparetime; | ||
364 | |||
365 | sb[22].StatID = (uint)Stats.SimSleepTime; | ||
366 | sb[22].StatValue = m_sleeptimeMS * perframe; | ||
367 | |||
368 | for (int i = 0; i < 23; i++) | ||
321 | { | 369 | { |
322 | lastReportedSimStats[i] = sb[i].StatValue; | 370 | lastReportedSimStats[i] = sb[i].StatValue; |
323 | } | 371 | } |
@@ -358,6 +406,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
358 | m_physicsMS = 0; | 406 | m_physicsMS = 0; |
359 | m_imageMS = 0; | 407 | m_imageMS = 0; |
360 | m_otherMS = 0; | 408 | m_otherMS = 0; |
409 | m_sleeptimeMS = 0; | ||
361 | 410 | ||
362 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 411 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
363 | //Ckrinke m_scriptMS = 0; | 412 | //Ckrinke m_scriptMS = 0; |
@@ -484,6 +533,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
484 | m_otherMS += ms; | 533 | m_otherMS += ms; |
485 | } | 534 | } |
486 | 535 | ||
536 | public void addSleepMS(int ms) | ||
537 | { | ||
538 | m_sleeptimeMS += ms; | ||
539 | } | ||
540 | |||
487 | public void AddPendingDownloads(int count) | 541 | public void AddPendingDownloads(int count) |
488 | { | 542 | { |
489 | m_pendingDownloads += count; | 543 | m_pendingDownloads += count; |