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 5c56264..a4afd47 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,43 @@ 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 | float sleeptime; | ||
268 | if (TotalFrameTime > targetframetime) | ||
269 | { | ||
270 | sparetime = 0; | ||
271 | sleeptime = 0; | ||
272 | } | ||
273 | else | ||
274 | { | ||
275 | sparetime = m_frameMS - m_physicsMS - m_agentMS; | ||
276 | sparetime *= perframe; | ||
277 | if (sparetime < 0) | ||
278 | sparetime = 0; | ||
279 | else if (sparetime > TotalFrameTime) | ||
280 | sparetime = TotalFrameTime; | ||
281 | sleeptime = m_sleeptimeMS * perframe; | ||
282 | } | ||
241 | 283 | ||
242 | //Our time dilation is 0.91 when we're running a full speed, | 284 | // other MS is actually simulation time |
243 | // therefore to make sure we get an appropriate range, | 285 | // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; |
244 | // we have to factor in our error. (0.10f * statsUpdateFactor) | 286 | // 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 | 287 | ||
249 | // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change | 288 | m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS; |
250 | // values to X-per-second values. | 289 | if (m_otherMS < 0) |
290 | m_otherMS = 0; | ||
251 | 291 | ||
252 | for (int i = 0; i < 21; i++) | 292 | for (int i = 0; i < 23; i++) |
253 | { | 293 | { |
254 | sb[i] = new SimStatsPacket.StatBlock(); | 294 | sb[i] = new SimStatsPacket.StatBlock(); |
255 | } | 295 | } |
@@ -279,19 +319,25 @@ namespace OpenSim.Region.Framework.Scenes | |||
279 | sb[7].StatValue = m_activePrim; | 319 | sb[7].StatValue = m_activePrim; |
280 | 320 | ||
281 | sb[8].StatID = (uint)Stats.FrameMS; | 321 | sb[8].StatID = (uint)Stats.FrameMS; |
282 | sb[8].StatValue = m_frameMS / statsUpdateFactor; | 322 | // sb[8].StatValue = m_frameMS / statsUpdateFactor; |
323 | sb[8].StatValue = TotalFrameTime; | ||
283 | 324 | ||
284 | sb[9].StatID = (uint)Stats.NetMS; | 325 | sb[9].StatID = (uint)Stats.NetMS; |
285 | sb[9].StatValue = m_netMS / statsUpdateFactor; | 326 | // sb[9].StatValue = m_netMS / statsUpdateFactor; |
327 | sb[9].StatValue = m_netMS * perframe; | ||
286 | 328 | ||
287 | sb[10].StatID = (uint)Stats.PhysicsMS; | 329 | sb[10].StatID = (uint)Stats.PhysicsMS; |
288 | sb[10].StatValue = m_physicsMS / statsUpdateFactor; | 330 | // sb[10].StatValue = m_physicsMS / statsUpdateFactor; |
331 | sb[10].StatValue = m_physicsMS * perframe; | ||
289 | 332 | ||
290 | sb[11].StatID = (uint)Stats.ImageMS ; | 333 | sb[11].StatID = (uint)Stats.ImageMS ; |
291 | sb[11].StatValue = m_imageMS / statsUpdateFactor; | 334 | // sb[11].StatValue = m_imageMS / statsUpdateFactor; |
335 | sb[11].StatValue = m_imageMS * perframe; | ||
292 | 336 | ||
293 | sb[12].StatID = (uint)Stats.OtherMS; | 337 | sb[12].StatID = (uint)Stats.OtherMS; |
294 | sb[12].StatValue = m_otherMS / statsUpdateFactor; | 338 | // sb[12].StatValue = m_otherMS / statsUpdateFactor; |
339 | sb[12].StatValue = m_otherMS * perframe; | ||
340 | |||
295 | 341 | ||
296 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; | 342 | sb[13].StatID = (uint)Stats.InPacketsPerSecond; |
297 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); | 343 | sb[13].StatValue = (m_inPacketsPerSecond / statsUpdateFactor); |
@@ -303,7 +349,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
303 | sb[15].StatValue = m_unAckedBytes; | 349 | sb[15].StatValue = m_unAckedBytes; |
304 | 350 | ||
305 | sb[16].StatID = (uint)Stats.AgentMS; | 351 | sb[16].StatID = (uint)Stats.AgentMS; |
306 | sb[16].StatValue = m_agentMS / statsUpdateFactor; | 352 | // sb[16].StatValue = m_agentMS / statsUpdateFactor; |
353 | sb[16].StatValue = m_agentMS * perframe; | ||
307 | 354 | ||
308 | sb[17].StatID = (uint)Stats.PendingDownloads; | 355 | sb[17].StatID = (uint)Stats.PendingDownloads; |
309 | sb[17].StatValue = m_pendingDownloads; | 356 | sb[17].StatValue = m_pendingDownloads; |
@@ -316,8 +363,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
316 | 363 | ||
317 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; | 364 | sb[20].StatID = (uint)Stats.ScriptLinesPerSecond; |
318 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; | 365 | sb[20].StatValue = m_scriptLinesPerSecond / statsUpdateFactor; |
319 | 366 | ||
320 | for (int i = 0; i < 21; i++) | 367 | sb[21].StatID = (uint)Stats.SimSpareTime; |
368 | sb[21].StatValue = sparetime; | ||
369 | |||
370 | sb[22].StatID = (uint)Stats.SimSleepTime; | ||
371 | sb[22].StatValue = sleeptime; | ||
372 | |||
373 | for (int i = 0; i < 23; i++) | ||
321 | { | 374 | { |
322 | lastReportedSimStats[i] = sb[i].StatValue; | 375 | lastReportedSimStats[i] = sb[i].StatValue; |
323 | } | 376 | } |
@@ -358,6 +411,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
358 | m_physicsMS = 0; | 411 | m_physicsMS = 0; |
359 | m_imageMS = 0; | 412 | m_imageMS = 0; |
360 | m_otherMS = 0; | 413 | m_otherMS = 0; |
414 | m_sleeptimeMS = 0; | ||
361 | 415 | ||
362 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. | 416 | //Ckrinke This variable is not used, so comment to remove compiler warning until it is used. |
363 | //Ckrinke m_scriptMS = 0; | 417 | //Ckrinke m_scriptMS = 0; |
@@ -484,6 +538,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
484 | m_otherMS += ms; | 538 | m_otherMS += ms; |
485 | } | 539 | } |
486 | 540 | ||
541 | public void addSleepMS(int ms) | ||
542 | { | ||
543 | m_sleeptimeMS += ms; | ||
544 | } | ||
545 | |||
487 | public void AddPendingDownloads(int count) | 546 | public void AddPendingDownloads(int count) |
488 | { | 547 | { |
489 | m_pendingDownloads += count; | 548 | m_pendingDownloads += count; |