aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes
diff options
context:
space:
mode:
authorMelanie2012-04-25 19:15:40 +0100
committerMelanie2012-04-25 19:15:40 +0100
commitdb31c9fe58f381fda7ddbee79fa467713b7c9bc6 (patch)
tree716ea72a563fd837dc39ef28d07bea272764277b /OpenSim/Region/Framework/Scenes
parentMerge branch 'master' into careminster (diff)
parentset PIDHoverTau and not PIDTau since all physics need that (diff)
downloadopensim-SC_OLD-db31c9fe58f381fda7ddbee79fa467713b7c9bc6.zip
opensim-SC_OLD-db31c9fe58f381fda7ddbee79fa467713b7c9bc6.tar.gz
opensim-SC_OLD-db31c9fe58f381fda7ddbee79fa467713b7c9bc6.tar.bz2
opensim-SC_OLD-db31c9fe58f381fda7ddbee79fa467713b7c9bc6.tar.xz
Merge branch 'master' of ssh://melanie@3dhosting.de/var/git/careminster into careminster
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs18
-rw-r--r--OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs43
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/SimStatsReporter.cs92
4 files changed, 115 insertions, 40 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 85b1242..515332f 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1386,10 +1386,12 @@ namespace OpenSim.Region.Framework.Scenes
1386 int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS; 1386 int tmpPhysicsMS, tmpPhysicsMS2, tmpAgentMS, tmpTempOnRezMS, evMS, backMS, terMS;
1387 int previousFrameTick; 1387 int previousFrameTick;
1388 int maintc; 1388 int maintc;
1389 int sleepMS;
1390 int framestart;
1389 1391
1390 while (!m_shuttingDown && (endFrame == null || Frame < endFrame)) 1392 while (!m_shuttingDown && (endFrame == null || Frame < endFrame))
1391 { 1393 {
1392 maintc = Util.EnvironmentTickCount(); 1394 framestart = Util.EnvironmentTickCount();
1393 ++Frame; 1395 ++Frame;
1394 1396
1395// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName); 1397// m_log.DebugFormat("[SCENE]: Processing frame {0} in {1}", Frame, RegionInfo.RegionName);
@@ -1476,7 +1478,7 @@ namespace OpenSim.Region.Framework.Scenes
1476 // landMS = Util.EnvironmentTickCountSubtract(ldMS); 1478 // landMS = Util.EnvironmentTickCountSubtract(ldMS);
1477 //} 1479 //}
1478 1480
1479 frameMS = Util.EnvironmentTickCountSubtract(maintc); 1481 // frameMS = Util.EnvironmentTickCountSubtract(maintc);
1480 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS; 1482 otherMS = tempOnRezMS + eventMS + backupMS + terrainMS + landMS;
1481 1483
1482 // if (Frame%m_update_avatars == 0) 1484 // if (Frame%m_update_avatars == 0)
@@ -1491,7 +1493,7 @@ namespace OpenSim.Region.Framework.Scenes
1491 1493
1492 // frameMS currently records work frame times, not total frame times (work + any required sleep to 1494 // frameMS currently records work frame times, not total frame times (work + any required sleep to
1493 // reach min frame time. 1495 // reach min frame time.
1494 StatsReporter.addFrameMS(frameMS); 1496 // StatsReporter.addFrameMS(frameMS);
1495 1497
1496 StatsReporter.addAgentMS(agentMS); 1498 StatsReporter.addAgentMS(agentMS);
1497 StatsReporter.addPhysicsMS(physicsMS + physicsMS2); 1499 StatsReporter.addPhysicsMS(physicsMS + physicsMS2);
@@ -1548,14 +1550,22 @@ namespace OpenSim.Region.Framework.Scenes
1548 1550
1549 previousFrameTick = m_lastFrameTick; 1551 previousFrameTick = m_lastFrameTick;
1550 m_lastFrameTick = Util.EnvironmentTickCount(); 1552 m_lastFrameTick = Util.EnvironmentTickCount();
1551 maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); 1553 maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, framestart);
1552 maintc = (int)(MinFrameTime * 1000) - maintc; 1554 maintc = (int)(MinFrameTime * 1000) - maintc;
1553 1555
1554 m_firstHeartbeat = false; 1556 m_firstHeartbeat = false;
1555 1557
1558
1559 sleepMS = Util.EnvironmentTickCount();
1560
1556 if (maintc > 0) 1561 if (maintc > 0)
1557 Thread.Sleep(maintc); 1562 Thread.Sleep(maintc);
1558 1563
1564 sleepMS = Util.EnvironmentTickCountSubtract(sleepMS);
1565 frameMS = Util.EnvironmentTickCountSubtract(framestart);
1566 StatsReporter.addSleepMS(sleepMS);
1567 StatsReporter.addFrameMS(frameMS);
1568
1559 // Optionally warn if a frame takes double the amount of time that it should. 1569 // Optionally warn if a frame takes double the amount of time that it should.
1560 if (DebugUpdates 1570 if (DebugUpdates
1561 && Util.EnvironmentTickCountSubtract( 1571 && Util.EnvironmentTickCountSubtract(
diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
index c47db97..66a6520 100644
--- a/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Framework/Scenes/SceneObjectGroup.cs
@@ -2339,7 +2339,7 @@ namespace OpenSim.Region.Framework.Scenes
2339 { 2339 {
2340 pa.PIDHoverHeight = height; 2340 pa.PIDHoverHeight = height;
2341 pa.PIDHoverType = hoverType; 2341 pa.PIDHoverType = hoverType;
2342 pa.PIDTau = tau; 2342 pa.PIDHoverTau = tau;
2343 pa.PIDHoverActive = true; 2343 pa.PIDHoverActive = true;
2344 } 2344 }
2345 else 2345 else
@@ -2664,19 +2664,21 @@ namespace OpenSim.Region.Framework.Scenes
2664 Quaternion oldRootRotation = linkPart.RotationOffset; 2664 Quaternion oldRootRotation = linkPart.RotationOffset;
2665 2665
2666 linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition; 2666 linkPart.OffsetPosition = linkPart.GroupPosition - AbsolutePosition;
2667
2667 linkPart.ParentID = m_rootPart.LocalId; 2668 linkPart.ParentID = m_rootPart.LocalId;
2668 linkPart.GroupPosition = AbsolutePosition; 2669
2669 Vector3 axPos = linkPart.OffsetPosition; 2670 linkPart.GroupPosition = AbsolutePosition;
2670 2671
2672 Vector3 axPos = linkPart.OffsetPosition;
2671 Quaternion parentRot = m_rootPart.RotationOffset; 2673 Quaternion parentRot = m_rootPart.RotationOffset;
2672 axPos *= Quaternion.Inverse(parentRot); 2674 axPos *= Quaternion.Inverse(parentRot);
2673
2674 linkPart.OffsetPosition = axPos; 2675 linkPart.OffsetPosition = axPos;
2676
2675 Quaternion oldRot = linkPart.RotationOffset; 2677 Quaternion oldRot = linkPart.RotationOffset;
2676 Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot; 2678 Quaternion newRot = Quaternion.Inverse(parentRot) * oldRot;
2677 linkPart.RotationOffset = newRot; 2679 linkPart.RotationOffset = newRot;
2678 2680
2679 linkPart.ParentID = m_rootPart.LocalId; 2681// linkPart.ParentID = m_rootPart.LocalId; done above
2680 2682
2681 if (m_rootPart.LinkNum == 0) 2683 if (m_rootPart.LinkNum == 0)
2682 m_rootPart.LinkNum = 1; 2684 m_rootPart.LinkNum = 1;
@@ -3707,16 +3709,25 @@ namespace OpenSim.Region.Framework.Scenes
3707 3709
3708 if (togroup) 3710 if (togroup)
3709 { 3711 {
3710 // related to group 3712 // related to group
3711 if ((change & ObjectChangeType.Position) != 0) 3713 if ((change & (ObjectChangeType.Rotation | ObjectChangeType.Position)) != 0)
3712 {
3713 group.AbsolutePosition = data.position;
3714 updateType = updatetype.groupterse;
3715 }
3716 if ((change & ObjectChangeType.Rotation) != 0)
3717 { 3714 {
3718 group.RootPart.UpdateRotation(data.rotation); 3715 if ((change & ObjectChangeType.Rotation) != 0)
3719 updateType = updatetype.none; 3716 {
3717 group.RootPart.UpdateRotation(data.rotation);
3718 updateType = updatetype.none;
3719 }
3720 if ((change & ObjectChangeType.Position) != 0)
3721 {
3722 group.AbsolutePosition = data.position;
3723 updateType = updatetype.groupterse;
3724 }
3725 else
3726 // ugly rotation update of all parts
3727 {
3728 group.AbsolutePosition = AbsolutePosition;
3729 }
3730
3720 } 3731 }
3721 if ((change & ObjectChangeType.Scale) != 0) 3732 if ((change & ObjectChangeType.Scale) != 0)
3722 { 3733 {
@@ -3741,10 +3752,10 @@ namespace OpenSim.Region.Framework.Scenes
3741 3752
3742 if (part == group.RootPart) 3753 if (part == group.RootPart)
3743 { 3754 {
3744 if ((change & ObjectChangeType.Position) != 0)
3745 group.UpdateRootPosition(data.position);
3746 if ((change & ObjectChangeType.Rotation) != 0) 3755 if ((change & ObjectChangeType.Rotation) != 0)
3747 group.UpdateRootRotation(data.rotation); 3756 group.UpdateRootRotation(data.rotation);
3757 if ((change & ObjectChangeType.Position) != 0)
3758 group.UpdateRootPosition(data.position);
3748 if ((change & ObjectChangeType.Scale) != 0) 3759 if ((change & ObjectChangeType.Scale) != 0)
3749 part.Resize(data.scale); 3760 part.Resize(data.scale);
3750 } 3761 }
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
index ebfc1bd..18a396f 100644
--- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs
@@ -755,7 +755,7 @@ namespace OpenSim.Region.Framework.Scenes
755 m_movementAnimationUpdateCounter = 0; 755 m_movementAnimationUpdateCounter = 0;
756 if (Animator != null) 756 if (Animator != null)
757 { 757 {
758 if(ParentID == 0) // skip it if sitting 758 if(ParentID == 0 && !SitGround) // skip it if sitting
759 Animator.UpdateMovementAnimations(); 759 Animator.UpdateMovementAnimations();
760 } 760 }
761 else 761 else
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;