aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs47
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs5
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs67
3 files changed, 69 insertions, 50 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 05af942..f501828 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -225,7 +225,6 @@ namespace OpenSim.Region.Framework.Scenes
225 private int backupMS; 225 private int backupMS;
226 private int terrainMS; 226 private int terrainMS;
227 private int landMS; 227 private int landMS;
228 private int spareMS;
229 228
230 /// <summary> 229 /// <summary>
231 /// Tick at which the last frame was processed. 230 /// Tick at which the last frame was processed.
@@ -1434,16 +1433,20 @@ namespace OpenSim.Region.Framework.Scenes
1434 endFrame = Frame + frames; 1433 endFrame = Frame + frames;
1435 1434
1436 float physicsFPS = 0f; 1435 float physicsFPS = 0f;
1437 int previousFrameTick, tmpMS; 1436 int tmpMS;
1438 int maintc = Util.EnvironmentTickCount(); 1437 int previousFrameTick;
1438 int maintc;
1439 int sleepMS;
1440 int framestart;
1439 1441
1440 while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) 1442 while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
1441 { 1443 {
1444 framestart = Util.EnvironmentTickCount();
1442 ++Frame; 1445 ++Frame;
1443 1446
1444// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1447// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
1445 1448
1446 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = spareMS = 0; 1449 agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0;
1447 1450
1448 try 1451 try
1449 { 1452 {
@@ -1495,6 +1498,7 @@ namespace OpenSim.Region.Framework.Scenes
1495 m_sceneGraph.UpdatePresences(); 1498 m_sceneGraph.UpdatePresences();
1496 1499
1497 agentMS += Util.EnvironmentTickCountSubtract(tmpMS); 1500 agentMS += Util.EnvironmentTickCountSubtract(tmpMS);
1501
1498 1502
1499 // Delete temp-on-rez stuff 1503 // Delete temp-on-rez stuff
1500 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps) 1504 if (Frame % m_update_temp_cleaning == 0 && !m_cleaningTemps)
@@ -1573,36 +1577,37 @@ namespace OpenSim.Region.Framework.Scenes
1573 1577
1574 Watchdog.UpdateThread(); 1578 Watchdog.UpdateThread();
1575 1579
1580 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1581
1582 StatsReporter.AddPhysicsFPS(physicsFPS);
1583 StatsReporter.AddTimeDilation(TimeDilation);
1584 StatsReporter.AddFPS(1);
1585
1586 StatsReporter.addAgentMS(agentMS);
1587 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1588 StatsReporter.addOtherMS(otherMS);
1589 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1590
1576 previousFrameTick = m_lastFrameTick; 1591 previousFrameTick = m_lastFrameTick;
1577 m_lastFrameTick = Util.EnvironmentTickCount(); 1592 m_lastFrameTick = Util.EnvironmentTickCount();
1578 tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); 1593 tmpMS = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart);
1579 tmpMS = (int)(MinFrameTime * 1000) - tmpMS; 1594 tmpMS = (int)(MinFrameTime * 1000) - tmpMS;
1580 1595
1581 m_firstHeartbeat = false; 1596 m_firstHeartbeat = false;
1582 1597
1598 sleepMS = Util.EnvironmentTickCount();
1599
1583 if (tmpMS > 0) 1600 if (tmpMS > 0)
1584 {
1585 Thread.Sleep(tmpMS); 1601 Thread.Sleep(tmpMS);
1586 spareMS += tmpMS;
1587 }
1588 1602
1589 frameMS = Util.EnvironmentTickCountSubtract(maintc); 1603 sleepMS = Util.EnvironmentTickCountSubtract(sleepMS);
1590 maintc = Util.EnvironmentTickCount(); 1604 frameMS = Util.EnvironmentTickCountSubtract(framestart);
1591 1605 StatsReporter.addSleepMS(sleepMS);
1592 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1606 StatsReporter.addFrameMS(frameMS);
1593 1607
1594 // if (Frame%m_update_avatars == 0) 1608 // if (Frame%m_update_avatars == 0)
1595 // UpdateInWorldTime(); 1609 // UpdateInWorldTime();
1596 StatsReporter.AddPhysicsFPS(physicsFPS);
1597 StatsReporter.AddTimeDilation(TimeDilation);
1598 StatsReporter.AddFPS(1);
1599 1610
1600 StatsReporter.addFrameMS(frameMS);
1601 StatsReporter.addAgentMS(agentMS);
1602 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
1603 StatsReporter.addOtherMS(otherMS);
1604 StatsReporter.AddSpareMS(spareMS);
1605 StatsReporter.addScriptLines(m_sceneGraph.GetScriptLPS());
1606 1611
1607 // Optionally warn if a frame takes double the amount of time that it should. 1612 // Optionally warn if a frame takes double the amount of time that it should.
1608 if (DebugUpdates 1613 if (DebugUpdates
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index f1f94a7..6ab0027 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -3066,7 +3066,7 @@ namespace OpenSim.Region.Framework.Scenes
3066 part.LinkNum = linkNum; 3066 part.LinkNum = linkNum;
3067 3067
3068 // Compute the new position of this SOP relative to the group position 3068 // Compute the new position of this SOP relative to the group position
3069 part.OffsetPosition = part.GroupPosition - AbsolutePosition; 3069 part.OffsetPosition = newPos - AbsolutePosition;
3070 3070
3071 // (radams1 20120711: I don't know why part.OffsetPosition is set multiple times. 3071 // (radams1 20120711: I don't know why part.OffsetPosition is set multiple times.
3072 // It would have the affect of setting the physics engine position multiple 3072 // It would have the affect of setting the physics engine position multiple
@@ -3087,7 +3087,8 @@ namespace OpenSim.Region.Framework.Scenes
3087 3087
3088 // Since this SOP's state has changed, push those changes into the physics engine 3088 // Since this SOP's state has changed, push those changes into the physics engine
3089 // and the simulator. 3089 // and the simulator.
3090 part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false); 3090 // done on caller
3091// part.UpdatePrimFlags(UsesPhysics, IsTemporary, IsPhantom, IsVolumeDetect, false);
3091 } 3092 }
3092 3093
3093 /// <summary> 3094 /// <summary>
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
index 18e6ece..d6ff5a2 100644
--- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
+++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs
@@ -164,7 +164,7 @@ namespace OpenSim.Region.Framework.Scenes
164 164
165 // saved last reported value so there is something available for llGetRegionFPS 165 // saved last reported value so there is something available for llGetRegionFPS
166 private float lastReportedSimFPS; 166 private float lastReportedSimFPS;
167 private float[] lastReportedSimStats = new float[22]; 167 private float[] lastReportedSimStats = new float[23];
168 private float m_pfps; 168 private float m_pfps;
169 169
170 /// <summary> 170 /// <summary>
@@ -178,12 +178,13 @@ namespace OpenSim.Region.Framework.Scenes
178 private int m_objectUpdates; 178 private int m_objectUpdates;
179 179
180 private int m_frameMS; 180 private int m_frameMS;
181 private int m_spareMS; 181
182 private int m_netMS; 182 private int m_netMS;
183 private int m_agentMS; 183 private int m_agentMS;
184 private int m_physicsMS; 184 private int m_physicsMS;
185 private int m_imageMS; 185 private int m_imageMS;
186 private int m_otherMS; 186 private int m_otherMS;
187 private int m_sleeptimeMS;
187 188
188//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed. 189//Ckrinke: (3-21-08) Comment out to remove a compiler warning. Bring back into play when needed.
189//Ckrinke private int m_scriptMS = 0; 190//Ckrinke private int m_scriptMS = 0;
@@ -260,7 +261,7 @@ namespace OpenSim.Region.Framework.Scenes
260 261
261 private void statsHeartBeat(object sender, EventArgs e) 262 private void statsHeartBeat(object sender, EventArgs e)
262 { 263 {
263 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[22]; 264 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[23];
264 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock(); 265 SimStatsPacket.RegionBlock rb = new SimStatsPacket.RegionBlock();
265 266
266 // Know what's not thread safe in Mono... modifying timers. 267 // Know what's not thread safe in Mono... modifying timers.
@@ -298,6 +299,8 @@ namespace OpenSim.Region.Framework.Scenes
298 physfps = 0; 299 physfps = 0;
299 300
300#endregion 301#endregion
302 float factor = 1 / m_statsUpdateFactor;
303
301 if (reportedFPS <= 0) 304 if (reportedFPS <= 0)
302 reportedFPS = 1; 305 reportedFPS = 1;
303 306
@@ -308,9 +311,22 @@ namespace OpenSim.Region.Framework.Scenes
308 float targetframetime = 1100.0f / (float)m_nominalReportedFps; 311 float targetframetime = 1100.0f / (float)m_nominalReportedFps;
309 312
310 float sparetime; 313 float sparetime;
314 float sleeptime;
315
311 if (TotalFrameTime > targetframetime) 316 if (TotalFrameTime > targetframetime)
312 { 317 {
313 sparetime = 0; 318 sparetime = 0;
319 sleeptime = 0;
320 }
321 else
322 {
323 sparetime = m_frameMS - m_physicsMS - m_agentMS;
324 sparetime *= perframe;
325 if (sparetime < 0)
326 sparetime = 0;
327 else if (sparetime > TotalFrameTime)
328 sparetime = TotalFrameTime;
329 sleeptime = m_sleeptimeMS * perframe;
314 } 330 }
315 331
316 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount(); 332 m_rootAgents = m_scene.SceneGraph.GetRootAgentCount();
@@ -327,19 +343,11 @@ namespace OpenSim.Region.Framework.Scenes
327 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS; 343 // m_otherMS = m_frameMS - m_physicsMS - m_imageMS - m_netMS - m_agentMS;
328 // m_imageMS m_netMS are not included in m_frameMS 344 // m_imageMS m_netMS are not included in m_frameMS
329 345
330 m_otherMS = m_frameMS - m_physicsMS - m_agentMS; 346 m_otherMS = m_frameMS - m_physicsMS - m_agentMS - m_sleeptimeMS;
331 if (m_otherMS < 0) 347 if (m_otherMS < 0)
332 m_otherMS = 0; 348 m_otherMS = 0;
333 349
334 uint thisFrame = m_scene.Frame; 350 for (int i = 0; i < 23; i++)
335 float framesUpdated = (float)(thisFrame - m_lastUpdateFrame) * m_reportedFpsCorrectionFactor;
336 m_lastUpdateFrame = thisFrame;
337
338 // Avoid div-by-zero if somehow we've not updated any frames.
339 if (framesUpdated == 0)
340 framesUpdated = 1;
341
342 for (int i = 0; i < 22; i++)
343 { 351 {
344 sb[i] = new SimStatsPacket.StatBlock(); 352 sb[i] = new SimStatsPacket.StatBlock();
345 } 353 }
@@ -369,19 +377,19 @@ namespace OpenSim.Region.Framework.Scenes
369 sb[7].StatValue = m_activePrim; 377 sb[7].StatValue = m_activePrim;
370 378
371 sb[8].StatID = (uint)Stats.FrameMS; 379 sb[8].StatID = (uint)Stats.FrameMS;
372 sb[8].StatValue = m_frameMS / framesUpdated; 380 sb[8].StatValue = TotalFrameTime;
373 381
374 sb[9].StatID = (uint)Stats.NetMS; 382 sb[9].StatID = (uint)Stats.NetMS;
375 sb[9].StatValue = m_netMS / framesUpdated; 383 sb[9].StatValue = m_netMS * perframe;
376 384
377 sb[10].StatID = (uint)Stats.PhysicsMS; 385 sb[10].StatID = (uint)Stats.PhysicsMS;
378 sb[10].StatValue = m_physicsMS / framesUpdated; 386 sb[10].StatValue = m_physicsMS * perframe;
379 387
380 sb[11].StatID = (uint)Stats.ImageMS ; 388 sb[11].StatID = (uint)Stats.ImageMS ;
381 sb[11].StatValue = m_imageMS / framesUpdated; 389 sb[11].StatValue = m_imageMS * perframe;
382 390
383 sb[12].StatID = (uint)Stats.OtherMS; 391 sb[12].StatID = (uint)Stats.OtherMS;
384 sb[12].StatValue = m_otherMS / framesUpdated; 392 sb[12].StatValue = m_otherMS * perframe;
385 393
386 sb[13].StatID = (uint)Stats.InPacketsPerSecond; 394 sb[13].StatID = (uint)Stats.InPacketsPerSecond;
387 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor); 395 sb[13].StatValue = (m_inPacketsPerSecond / m_statsUpdateFactor);
@@ -393,7 +401,7 @@ namespace OpenSim.Region.Framework.Scenes
393 sb[15].StatValue = m_unAckedBytes; 401 sb[15].StatValue = m_unAckedBytes;
394 402
395 sb[16].StatID = (uint)Stats.AgentMS; 403 sb[16].StatID = (uint)Stats.AgentMS;
396 sb[16].StatValue = m_agentMS / framesUpdated; 404 sb[16].StatValue = m_agentMS * perframe;
397 405
398 sb[17].StatID = (uint)Stats.PendingDownloads; 406 sb[17].StatID = (uint)Stats.PendingDownloads;
399 sb[17].StatValue = m_pendingDownloads; 407 sb[17].StatValue = m_pendingDownloads;
@@ -408,7 +416,10 @@ namespace OpenSim.Region.Framework.Scenes
408 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor; 416 sb[20].StatValue = m_scriptLinesPerSecond / m_statsUpdateFactor;
409 417
410 sb[21].StatID = (uint)Stats.SimSpareMs; 418 sb[21].StatID = (uint)Stats.SimSpareMs;
411 sb[21].StatValue = m_spareMS / framesUpdated; 419 sb[21].StatValue = sparetime;
420
421 sb[22].StatID = (uint)Stats.SimSleepMs;
422 sb[22].StatValue = sleeptime;
412 423
413 for (int i = 0; i < 22; i++) 424 for (int i = 0; i < 22; i++)
414 { 425 {
@@ -441,13 +452,14 @@ namespace OpenSim.Region.Framework.Scenes
441 // Need to change things so that stats source can indicate whether they are per second or 452 // Need to change things so that stats source can indicate whether they are per second or
442 // per frame. 453 // per frame.
443 if (tuple.Key.EndsWith("MS")) 454 if (tuple.Key.EndsWith("MS"))
444 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / framesUpdated; 455 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value * perframe;
445 else 456 else
446 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor; 457 m_lastReportedExtraSimStats[tuple.Key] = tuple.Value / m_statsUpdateFactor;
447 } 458 }
448 } 459 }
449 } 460 }
450 461
462// LastReportedObjectUpdates = m_objectUpdates / m_statsUpdateFactor;
451 ResetValues(); 463 ResetValues();
452 } 464 }
453 } 465 }
@@ -470,7 +482,8 @@ namespace OpenSim.Region.Framework.Scenes
470 m_physicsMS = 0; 482 m_physicsMS = 0;
471 m_imageMS = 0; 483 m_imageMS = 0;
472 m_otherMS = 0; 484 m_otherMS = 0;
473 m_spareMS = 0; 485// m_spareMS = 0;
486 m_sleeptimeMS = 0;
474 487
475//Ckrinke This variable is not used, so comment to remove compiler warning until it is used. 488//Ckrinke This variable is not used, so comment to remove compiler warning until it is used.
476//Ckrinke m_scriptMS = 0; 489//Ckrinke m_scriptMS = 0;
@@ -549,11 +562,6 @@ namespace OpenSim.Region.Framework.Scenes
549 m_frameMS += ms; 562 m_frameMS += ms;
550 } 563 }
551 564
552 public void AddSpareMS(int ms)
553 {
554 m_spareMS += ms;
555 }
556
557 public void addNetMS(int ms) 565 public void addNetMS(int ms)
558 { 566 {
559 m_netMS += ms; 567 m_netMS += ms;
@@ -579,6 +587,11 @@ namespace OpenSim.Region.Framework.Scenes
579 m_otherMS += ms; 587 m_otherMS += ms;
580 } 588 }
581 589
590 public void addSleepMS(int ms)
591 {
592 m_sleeptimeMS += ms;
593 }
594
582 public void AddPendingDownloads(int count) 595 public void AddPendingDownloads(int count)
583 { 596 {
584 m_pendingDownloads += count; 597 m_pendingDownloads += count;