aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorTeravus Ovares2007-12-12 06:58:55 +0000
committerTeravus Ovares2007-12-12 06:58:55 +0000
commit081f4403ea2a2f8352d480910052bf5032e2e4a5 (patch)
tree9eeda0d127f84b1e0538ac834e7921a074b6503e /OpenSim/Region
parent* Patch from justincc to fix Inconsistent automatic mysql table creation - se... (diff)
downloadopensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.zip
opensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.tar.gz
opensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.tar.bz2
opensim-SC-081f4403ea2a2f8352d480910052bf5032e2e4a5.tar.xz
* Added some simstats to fill the simulator pane of the Statistics monitor.
* I stress, this is an initial implementation and the Agents(Child and Root) are definately obviously incorrect.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs52
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs78
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs3
-rw-r--r--OpenSim/Region/Environment/Scenes/SimStatsReporter.cs158
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs4
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs8
-rw-r--r--OpenSim/Region/Physics/Manager/PhysicsScene.cs5
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs52
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs5
-rw-r--r--OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs4
10 files changed, 335 insertions, 34 deletions
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index c0e07cb..b274d47 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -57,6 +57,9 @@ namespace OpenSim.Region.Environment.Scenes
57 protected RegionInfo m_regInfo; 57 protected RegionInfo m_regInfo;
58 protected Scene m_parentScene; 58 protected Scene m_parentScene;
59 protected PermissionManager PermissionsMngr; 59 protected PermissionManager PermissionsMngr;
60 protected int m_numRootAgents = 0;
61 protected int m_numPrim = 0;
62 protected int m_numChildAgents = 0;
60 63
61 internal object m_syncRoot = new object(); 64 internal object m_syncRoot = new object();
62 65
@@ -133,11 +136,11 @@ namespace OpenSim.Region.Environment.Scenes
133 } 136 }
134 } 137 }
135 138
136 internal void UpdatePhysics(double elapsed) 139 internal float UpdatePhysics(double elapsed)
137 { 140 {
138 lock (m_syncRoot) 141 lock (m_syncRoot)
139 { 142 {
140 _PhyScene.Simulate((float)elapsed); 143 return _PhyScene.Simulate((float)elapsed);
141 } 144 }
142 } 145 }
143 146
@@ -171,6 +174,7 @@ namespace OpenSim.Region.Environment.Scenes
171 { 174 {
172 // QuadTree.AddObject(sceneObject); 175 // QuadTree.AddObject(sceneObject);
173 Entities.Add(sceneObject.UUID, sceneObject); 176 Entities.Add(sceneObject.UUID, sceneObject);
177 m_numPrim++;
174 } 178 }
175 } 179 }
176 180
@@ -183,6 +187,7 @@ namespace OpenSim.Region.Environment.Scenes
183 if (((SceneObjectGroup)obj).LocalId == localID) 187 if (((SceneObjectGroup)obj).LocalId == localID)
184 { 188 {
185 m_parentScene.RemoveEntity((SceneObjectGroup)obj); 189 m_parentScene.RemoveEntity((SceneObjectGroup)obj);
190 m_numPrim--;
186 return; 191 return;
187 } 192 }
188 } 193 }
@@ -198,10 +203,12 @@ namespace OpenSim.Region.Environment.Scenes
198 203
199 if (child) 204 if (child)
200 { 205 {
206 m_numChildAgents++;
201 MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Creating new child agent."); 207 MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Creating new child agent.");
202 } 208 }
203 else 209 else
204 { 210 {
211 m_numRootAgents++;
205 MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Creating new root agent."); 212 MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Creating new root agent.");
206 MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Adding Physical agent."); 213 MainLog.Instance.Verbose("SCENE", m_regInfo.RegionName + ": Adding Physical agent.");
207 214
@@ -233,6 +240,47 @@ namespace OpenSim.Region.Environment.Scenes
233 240
234 return newAvatar; 241 return newAvatar;
235 } 242 }
243 public void SwapRootChildAgent(bool direction_RC_CR_T_F)
244 {
245 if (direction_RC_CR_T_F)
246 {
247 m_numRootAgents--;
248 m_numChildAgents++;
249 }
250 else
251 {
252 m_numChildAgents--;
253 m_numRootAgents++;
254 }
255 }
256 public void removeUserCount(bool TypeRCTF)
257 {
258 if (TypeRCTF)
259 {
260 m_numRootAgents--;
261 }
262 else
263 {
264 m_numChildAgents--;
265 }
266 }
267 public void RemoveAPrimCount()
268 {
269 m_numPrim--;
270 }
271 public void AddAPrimCount()
272 {
273 m_numPrim++;
274 }
275 public int GetChildAgentCount()
276 {
277 return m_numChildAgents;
278 }
279
280 public int GetRootAgentCount()
281 {
282 return m_numRootAgents;
283 }
236 #endregion 284 #endregion
237 285
238 #region Get Methods 286 #region Get Methods
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index f2b5643..5462e77 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -59,6 +59,8 @@ namespace OpenSim.Region.Environment.Scenes
59 protected Timer m_heartbeatTimer = new Timer(); 59 protected Timer m_heartbeatTimer = new Timer();
60 protected Timer m_restartWaitTimer = new Timer(); 60 protected Timer m_restartWaitTimer = new Timer();
61 61
62 protected SimStatsReporter m_statsReporter;
63
62 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>(); 64 protected List<RegionInfo> m_regionRestartNotifyList = new List<RegionInfo>();
63 protected List<RegionInfo> m_neighbours = new List<RegionInfo>(); 65 protected List<RegionInfo> m_neighbours = new List<RegionInfo>();
64 66
@@ -256,6 +258,9 @@ namespace OpenSim.Region.Environment.Scenes
256 258
257 httpListener = httpServer; 259 httpListener = httpServer;
258 m_dumpAssetsToFile = dumpAssetsToFile; 260 m_dumpAssetsToFile = dumpAssetsToFile;
261
262 m_statsReporter = new SimStatsReporter(regInfo);
263 m_statsReporter.OnSendStatsResult += SendSimStatsPackets;
259 } 264 }
260 265
261 #endregion 266 #endregion
@@ -531,7 +536,7 @@ namespace OpenSim.Region.Environment.Scenes
531 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate; 536 TimeSpan SinceLastFrame = DateTime.Now - m_lastupdate;
532 // Aquire a lock so only one update call happens at once 537 // Aquire a lock so only one update call happens at once
533 updateLock.WaitOne(); 538 updateLock.WaitOne();
534 539 float physicsFPS = 0;
535 try 540 try
536 { 541 {
537 // Increment the frame counter 542 // Increment the frame counter
@@ -548,7 +553,7 @@ namespace OpenSim.Region.Environment.Scenes
548 m_innerScene.UpdateEntityMovement(); 553 m_innerScene.UpdateEntityMovement();
549 554
550 if (m_frame % m_update_physics == 0) 555 if (m_frame % m_update_physics == 0)
551 m_innerScene.UpdatePhysics( 556 physicsFPS = m_innerScene.UpdatePhysics(
552 Math.Max(SinceLastFrame.TotalSeconds, m_timespan) 557 Math.Max(SinceLastFrame.TotalSeconds, m_timespan)
553 ); 558 );
554 559
@@ -569,6 +574,14 @@ namespace OpenSim.Region.Environment.Scenes
569 574
570 // if (m_frame%m_update_avatars == 0) 575 // if (m_frame%m_update_avatars == 0)
571 // UpdateInWorldTime(); 576 // UpdateInWorldTime();
577 m_statsReporter.AddPhysicsFPS(physicsFPS);
578 m_statsReporter.SetTimeDilation(m_timedilation);
579 m_statsReporter.AddFPS(1);
580 m_statsReporter.AddAgentUpdates(1);
581 m_statsReporter.AddInPackets(0);
582 m_statsReporter.SetRootAgents(m_innerScene.GetRootAgentCount());
583 m_statsReporter.SetChildAgents(m_innerScene.GetChildAgentCount());
584
572 } 585 }
573 catch (NotImplementedException) 586 catch (NotImplementedException)
574 { 587 {
@@ -607,6 +620,19 @@ namespace OpenSim.Region.Environment.Scenes
607 } 620 }
608 } 621 }
609 622
623 private void SendSimStatsPackets(libsecondlife.Packets.SimStatsPacket pack)
624 {
625 List<ScenePresence> StatSendAgents = GetScenePresences();
626 foreach (ScenePresence agent in StatSendAgents)
627 {
628 if (!agent.IsChildAgent)
629 {
630 agent.ControllingClient.OutPacket(pack, ThrottleOutPacketType.Task);
631
632 }
633 }
634
635 }
610 private void UpdateLand() 636 private void UpdateLand()
611 { 637 {
612 if (m_LandManager.landPrimCountTainted) 638 if (m_LandManager.landPrimCountTainted)
@@ -939,6 +965,7 @@ namespace OpenSim.Region.Environment.Scenes
939 // subscribe to physics events. 965 // subscribe to physics events.
940 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true); 966 rootPart.DoPhysicsPropertyUpdate(UsePhysics, true);
941 } 967 }
968 m_innerScene.AddAPrimCount();
942 } 969 }
943 } 970 }
944 971
@@ -967,6 +994,7 @@ namespace OpenSim.Region.Environment.Scenes
967 public void AddEntity(SceneObjectGroup sceneObject) 994 public void AddEntity(SceneObjectGroup sceneObject)
968 { 995 {
969 m_innerScene.AddEntity(sceneObject); 996 m_innerScene.AddEntity(sceneObject);
997
970 } 998 }
971 999
972 public void RemoveEntity(SceneObjectGroup sceneObject) 1000 public void RemoveEntity(SceneObjectGroup sceneObject)
@@ -976,6 +1004,7 @@ namespace OpenSim.Region.Environment.Scenes
976 m_LandManager.removePrimFromLandPrimCounts(sceneObject); 1004 m_LandManager.removePrimFromLandPrimCounts(sceneObject);
977 Entities.Remove(sceneObject.UUID); 1005 Entities.Remove(sceneObject.UUID);
978 m_LandManager.setPrimsTainted(); 1006 m_LandManager.setPrimsTainted();
1007 m_innerScene.RemoveAPrimCount();
979 } 1008 }
980 } 1009 }
981 1010
@@ -1135,7 +1164,16 @@ namespace OpenSim.Region.Environment.Scenes
1135 m_eventManager.TriggerOnRemovePresence(agentID); 1164 m_eventManager.TriggerOnRemovePresence(agentID);
1136 1165
1137 ScenePresence avatar = GetScenePresence(agentID); 1166 ScenePresence avatar = GetScenePresence(agentID);
1138 1167
1168 if (avatar.IsChildAgent)
1169 {
1170 m_innerScene.removeUserCount(false);
1171 }
1172 else
1173 {
1174 m_innerScene.removeUserCount(true);
1175 }
1176
1139 Broadcast(delegate(IClientAPI client) 1177 Broadcast(delegate(IClientAPI client)
1140 { 1178 {
1141 try 1179 try
@@ -1196,6 +1234,7 @@ namespace OpenSim.Region.Environment.Scenes
1196 { 1234 {
1197 Entities.Remove(entID); 1235 Entities.Remove(entID);
1198 m_storageManager.DataStore.RemoveObject(entID, m_regInfo.RegionID); 1236 m_storageManager.DataStore.RemoveObject(entID, m_regInfo.RegionID);
1237 m_innerScene.RemoveAPrimCount();
1199 return true; 1238 return true;
1200 } 1239 }
1201 return false; 1240 return false;
@@ -1287,6 +1326,7 @@ namespace OpenSim.Region.Environment.Scenes
1287 if (m_scenePresences.ContainsKey(agentID)) 1326 if (m_scenePresences.ContainsKey(agentID))
1288 { 1327 {
1289 m_scenePresences[agentID].MakeRootAgent(position, isFlying); 1328 m_scenePresences[agentID].MakeRootAgent(position, isFlying);
1329 m_innerScene.SwapRootChildAgent(false);
1290 } 1330 }
1291 } 1331 }
1292 } 1332 }
@@ -1321,6 +1361,14 @@ namespace OpenSim.Region.Environment.Scenes
1321 ScenePresence presence = m_innerScene.GetScenePresence(agentID); 1361 ScenePresence presence = m_innerScene.GetScenePresence(agentID);
1322 if (presence != null) 1362 if (presence != null)
1323 { 1363 {
1364 if (presence.IsChildAgent)
1365 {
1366 m_innerScene.removeUserCount(false);
1367 }
1368 else
1369 {
1370 m_innerScene.removeUserCount(true);
1371 }
1324 // Tell a single agent to disconnect from the region. 1372 // Tell a single agent to disconnect from the region.
1325 libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket(); 1373 libsecondlife.Packets.DisableSimulatorPacket disable = new libsecondlife.Packets.DisableSimulatorPacket();
1326 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task); 1374 presence.ControllingClient.OutPacket(disable, ThrottleOutPacketType.Task);
@@ -1617,6 +1665,16 @@ namespace OpenSim.Region.Environment.Scenes
1617 if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness? 1665 if (controller.AgentId != godID && !childagent) // Do we really want to kick the initiator of this madness?
1618 { 1666 {
1619 controller.Kick(Helpers.FieldToUTF8String(reason)); 1667 controller.Kick(Helpers.FieldToUTF8String(reason));
1668
1669 if (childagent)
1670 {
1671 m_innerScene.removeUserCount(false);
1672 }
1673 else
1674 {
1675 m_innerScene.removeUserCount(true);
1676 }
1677
1620 } 1678 }
1621 } 1679 }
1622 ); 1680 );
@@ -1636,6 +1694,15 @@ namespace OpenSim.Region.Environment.Scenes
1636 } 1694 }
1637 else 1695 else
1638 { 1696 {
1697 if (m_scenePresences[agentID].IsChildAgent)
1698 {
1699 m_innerScene.removeUserCount(false);
1700 }
1701 else
1702 {
1703 m_innerScene.removeUserCount(true);
1704 }
1705
1639 m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason)); 1706 m_scenePresences[agentID].ControllingClient.Kick(Helpers.FieldToUTF8String(reason));
1640 m_scenePresences[agentID].ControllingClient.Close(); 1707 m_scenePresences[agentID].ControllingClient.Close();
1641 } 1708 }
@@ -1848,7 +1915,10 @@ namespace OpenSim.Region.Environment.Scenes
1848 { 1915 {
1849 return m_innerScene.ConvertLocalIDToFullID(localID); 1916 return m_innerScene.ConvertLocalIDToFullID(localID);
1850 } 1917 }
1851 1918 public void SwapRootAgentCount(bool rootChildChildRootTF)
1919 {
1920 m_innerScene.SwapRootChildAgent(rootChildChildRootTF);
1921 }
1852 /// <summary> 1922 /// <summary>
1853 /// 1923 ///
1854 /// </summary> 1924 /// </summary>
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index c82d066..0640067 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -465,6 +465,7 @@ namespace OpenSim.Region.Environment.Scenes
465 AddToPhysicalScene(); 465 AddToPhysicalScene();
466 m_physicsActor.Flying = isFlying; 466 m_physicsActor.Flying = isFlying;
467 467
468 m_scene.SwapRootAgentCount(false);
468 m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid); 469 m_scene.CommsManager.UserProfileCacheService.UpdateUserInventory(m_uuid);
469 //if (!m_gotAllObjectsInScene) 470 //if (!m_gotAllObjectsInScene)
470 //{ 471 //{
@@ -484,7 +485,7 @@ namespace OpenSim.Region.Environment.Scenes
484 { 485 {
485 Velocity = new LLVector3(0, 0, 0); 486 Velocity = new LLVector3(0, 0, 0);
486 m_isChildAgent = true; 487 m_isChildAgent = true;
487 488 m_scene.SwapRootAgentCount(true);
488 RemoveFromPhysicalScene(); 489 RemoveFromPhysicalScene();
489 490
490 //this.Pos = new LLVector3(128, 128, 70); 491 //this.Pos = new LLVector3(128, 128, 70);
diff --git a/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
new file mode 100644
index 0000000..55bd6a7
--- /dev/null
+++ b/OpenSim/Region/Environment/Scenes/SimStatsReporter.cs
@@ -0,0 +1,158 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4using System.Timers;
5using libsecondlife.Packets;
6using OpenSim.Framework;
7using Timer = System.Timers.Timer;
8
9namespace OpenSim.Region.Environment.Scenes
10{
11 public class SimStatsReporter
12 {
13 public delegate void SendStatResult(SimStatsPacket pack);
14
15 public event SendStatResult OnSendStatsResult;
16
17 private enum Stats : uint
18 {
19 TimeDilation = 0,
20 SimFPS = 1,
21 PhysicsFPS = 2,
22 AgentUpdates = 3,
23 Agents = 13,
24 ChildAgents = 14,
25 InPacketsPerSecond = 17,
26 OutPacketsPerSecond = 18,
27 UnAckedBytes = 24
28 }
29
30 private int statsUpdatesEveryMS = 1000;
31 private float m_timeDilation = 0;
32 private int m_fps = 0;
33 private float m_pfps = 0;
34 private float m_agentUpdates = 0;
35 private int m_rootAgents = 0;
36 private int m_childAgents = 0;
37 private int m_inPacketsPerSecond = 0;
38 private int m_outPacketsPerSecond = 0;
39 private int m_unAckedBytes = 0;
40 private RegionInfo ReportingRegion;
41
42 private Timer m_report = new Timer();
43
44
45 public SimStatsReporter(RegionInfo regionData)
46 {
47 ReportingRegion = regionData;
48 m_report.AutoReset = true;
49 m_report.Interval = statsUpdatesEveryMS;
50 m_report.Elapsed += new ElapsedEventHandler(statsHeartBeat);
51 m_report.Enabled = true;
52 }
53
54 private void statsHeartBeat(object sender, EventArgs e)
55 {
56 m_report.Enabled = false;
57 SimStatsPacket statpack = new SimStatsPacket();
58 SimStatsPacket.StatBlock[] sb = new SimStatsPacket.StatBlock[9];
59 statpack.Region = new SimStatsPacket.RegionBlock();
60 statpack.Region.RegionX = ReportingRegion.RegionLocX;
61 statpack.Region.RegionY = ReportingRegion.RegionLocY;
62 statpack.Region.RegionFlags = (uint)21;
63 statpack.Region.ObjectCapacity = (uint)15000;
64
65 sb[0] = new SimStatsPacket.StatBlock();
66 sb[0].StatID = (uint)Stats.TimeDilation;
67 sb[0].StatValue = (m_timeDilation);
68
69 sb[1] = new SimStatsPacket.StatBlock();
70 sb[1].StatID = (uint)Stats.SimFPS;
71 sb[1].StatValue = (int)(m_fps);
72
73 sb[2] = new SimStatsPacket.StatBlock();
74 sb[2].StatID = (uint)Stats.PhysicsFPS;
75 sb[2].StatValue = (m_pfps / statsUpdatesEveryMS);
76
77 sb[3] = new SimStatsPacket.StatBlock();
78 sb[3].StatID = (uint)Stats.AgentUpdates;
79 sb[3].StatValue = (m_agentUpdates / statsUpdatesEveryMS);
80
81 sb[4] = new SimStatsPacket.StatBlock();
82 sb[4].StatID = (uint)Stats.Agents;
83 sb[4].StatValue = m_rootAgents;
84
85 sb[5] = new SimStatsPacket.StatBlock();
86 sb[5].StatID = (uint)Stats.ChildAgents;
87 sb[5].StatValue = m_childAgents;
88
89 sb[6] = new SimStatsPacket.StatBlock();
90 sb[6].StatID = (uint)Stats.InPacketsPerSecond;
91 sb[6].StatValue = (int)(m_inPacketsPerSecond / statsUpdatesEveryMS);
92
93 sb[7] = new SimStatsPacket.StatBlock();
94 sb[7].StatID = (uint)Stats.OutPacketsPerSecond;
95 sb[7].StatValue = (int)(m_outPacketsPerSecond / statsUpdatesEveryMS);
96
97 sb[8] = new SimStatsPacket.StatBlock();
98 sb[8].StatID = (uint)Stats.UnAckedBytes;
99 sb[8].StatValue = (int) (m_unAckedBytes / statsUpdatesEveryMS);
100
101 statpack.Stat = sb;
102
103 if (OnSendStatsResult != null)
104 {
105 OnSendStatsResult(statpack);
106 }
107 resetvalues();
108 m_report.Enabled = true;
109 }
110
111 private void resetvalues()
112 {
113 m_fps = 0;
114 m_pfps = 0;
115 m_agentUpdates = 0;
116 m_inPacketsPerSecond = 0;
117 m_outPacketsPerSecond = 0;
118 m_unAckedBytes = 0;
119
120 }
121 public void SetTimeDilation(float td)
122 {
123 m_timeDilation = td;
124 }
125 public void SetRootAgents(int rootAgents)
126 {
127 m_rootAgents = rootAgents;
128 }
129 public void SetChildAgents(int childAgents)
130 {
131 m_childAgents = childAgents;
132 }
133 public void AddFPS(int frames)
134 {
135 m_fps += frames;
136 }
137 public void AddPhysicsFPS(float frames)
138 {
139 m_pfps += frames;
140 }
141 public void AddAgentUpdates(float numUpdates)
142 {
143 m_agentUpdates += numUpdates;
144 }
145 public void AddInPackets(int numPackets)
146 {
147 m_inPacketsPerSecond += numPackets;
148 }
149 public void AddOutPackets(int numPackets)
150 {
151 m_outPacketsPerSecond += numPackets;
152 }
153 public void AddunAckedBytes(int numBytes)
154 {
155 m_unAckedBytes += numBytes;
156 }
157 }
158}
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index 6b647b1..df3ebb9 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -118,8 +118,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
118 { 118 {
119 119
120 } 120 }
121 public override void Simulate(float timeStep) 121 public override float Simulate(float timeStep)
122 { 122 {
123 float fps = 0;
123 for (int i = 0; i < _actors.Count; ++i) 124 for (int i = 0; i < _actors.Count; ++i)
124 { 125 {
125 BasicActor actor = _actors[i]; 126 BasicActor actor = _actors[i];
@@ -164,6 +165,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
164 actor.Velocity.Z = 0; 165 actor.Velocity.Z = 0;
165 } 166 }
166 } 167 }
168 return fps;
167 } 169 }
168 170
169 public override void GetResults() 171 public override void GetResults()
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 4b1043a..1760e50 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -515,20 +515,26 @@ namespace OpenSim.Region.Physics.BulletXPlugin
515 { 515 {
516 516
517 } 517 }
518 public override void Simulate(float timeStep) 518 public override float Simulate(float timeStep)
519 { 519 {
520 float fps = 0;
520 lock (BulletXLock) 521 lock (BulletXLock)
521 { 522 {
522 //Try to remove garbage 523 //Try to remove garbage
523 RemoveForgottenRigidBodies(); 524 RemoveForgottenRigidBodies();
524 //End of remove 525 //End of remove
525 MoveAllObjects(timeStep); 526 MoveAllObjects(timeStep);
527
528
529 fps = (timeStep * simulationSubSteps);
530
526 ddWorld.StepSimulation(timeStep, simulationSubSteps, timeStep); 531 ddWorld.StepSimulation(timeStep, simulationSubSteps, timeStep);
527 //Extra Heightmap Validation: BulletX's HeightFieldTerrain somestimes doesn't work so fine. 532 //Extra Heightmap Validation: BulletX's HeightFieldTerrain somestimes doesn't work so fine.
528 ValidateHeightForAll(); 533 ValidateHeightForAll();
529 //End heightmap validation. 534 //End heightmap validation.
530 UpdateKineticsForAll(); 535 UpdateKineticsForAll();
531 } 536 }
537 return fps;
532 } 538 }
533 539
534 private void MoveAllObjects(float timeStep) 540 private void MoveAllObjects(float timeStep)
diff --git a/OpenSim/Region/Physics/Manager/PhysicsScene.cs b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
index 71cba22..c63a66d 100644
--- a/OpenSim/Region/Physics/Manager/PhysicsScene.cs
+++ b/OpenSim/Region/Physics/Manager/PhysicsScene.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Region.Physics.Manager
70 PhysicsVector size, Quaternion rotation, bool isPhysical); 70 PhysicsVector size, Quaternion rotation, bool isPhysical);
71 public abstract void AddPhysicsActorTaint(PhysicsActor prim); 71 public abstract void AddPhysicsActorTaint(PhysicsActor prim);
72 72
73 public abstract void Simulate(float timeStep); 73 public abstract float Simulate(float timeStep);
74 74
75 public abstract void GetResults(); 75 public abstract void GetResults();
76 76
@@ -126,11 +126,12 @@ namespace OpenSim.Region.Physics.Manager
126 { 126 {
127 127
128 } 128 }
129 public override void Simulate(float timeStep) 129 public override float Simulate(float timeStep)
130 { 130 {
131 m_workIndicator = (m_workIndicator + 1)%10; 131 m_workIndicator = (m_workIndicator + 1)%10;
132 132
133 //MainLog.Instance.SetStatus(m_workIndicator.ToString()); 133 //MainLog.Instance.SetStatus(m_workIndicator.ToString());
134 return 0f;
134 } 135 }
135 136
136 public override void GetResults() 137 public override void GetResults()
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 5234cd3..a765878 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -787,9 +787,10 @@ namespace OpenSim.Region.Physics.OdePlugin
787 } 787 }
788 } 788 }
789 789
790 public override void Simulate(float timeStep) 790 public override float Simulate(float timeStep)
791 { 791 {
792 792 float fps = 0;
793
793 step_time += timeStep; 794 step_time += timeStep;
794 795
795 796
@@ -800,32 +801,40 @@ namespace OpenSim.Region.Physics.OdePlugin
800 801
801 802
802 803
803 if (step_time >= m_SkipFramesAtms) 804 if (step_time >= m_SkipFramesAtms)
804 { 805 {
805 // Instead of trying to catch up, it'll do one physics frame only 806 // Instead of trying to catch up, it'll do one physics frame only
806 step_time = ODE_STEPSIZE; 807 step_time = ODE_STEPSIZE;
807 this.m_physicsiterations = 5; 808 this.m_physicsiterations = 5;
809 }
810 else
811 {
812 m_physicsiterations = 10;
813 }
814 lock (OdeLock)
815 {
816 // Process 10 frames if the sim is running normal..
817 // process 5 frames if the sim is running slow
818 try{
819 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
808 } 820 }
809 else 821 catch (System.StackOverflowException)
810 { 822 {
811 m_physicsiterations = 10; 823 MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
824 base.TriggerPhysicsBasedRestart();
812 } 825 }
813 lock (OdeLock)
814 {
815 // Process 10 frames if the sim is running normal..
816 // process 5 frames if the sim is running slow
817 try{
818 d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
819 }
820 catch (System.StackOverflowException)
821 {
822 MainLog.Instance.Error("PHYSICS", "The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
823 base.TriggerPhysicsBasedRestart();
824 }
825 826
826 int i = 0; 827 int i = 0;
828
829
830 // Figure out the Frames Per Second we're going at.
831
832 fps = (((step_time / ODE_STEPSIZE * m_physicsiterations)*2)* 10);
833
834
827 while (step_time > 0.0f) 835 while (step_time > 0.0f)
828 { 836 {
837
829 foreach (OdeCharacter actor in _characters) 838 foreach (OdeCharacter actor in _characters)
830 { 839 {
831 actor.Move(timeStep); 840 actor.Move(timeStep);
@@ -875,6 +884,7 @@ namespace OpenSim.Region.Physics.OdePlugin
875 } 884 }
876 } 885 }
877 } 886 }
887 return fps;
878 } 888 }
879 889
880 public override void GetResults() 890 public override void GetResults()
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index 4355c5e..efc30fe 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -169,10 +169,12 @@ namespace OpenSim.Region.Physics.POSPlugin
169 169
170 } 170 }
171 171
172 public override void Simulate(float timeStep) 172 public override float Simulate(float timeStep)
173 { 173 {
174 float fps = 0;
174 for (int i = 0; i < _characters.Count; ++i) 175 for (int i = 0; i < _characters.Count; ++i)
175 { 176 {
177 fps++;
176 POSCharacter character = _characters[i]; 178 POSCharacter character = _characters[i];
177 179
178 float oldposX = character.Position.X; 180 float oldposX = character.Position.X;
@@ -286,6 +288,7 @@ namespace OpenSim.Region.Physics.POSPlugin
286 character._velocity.Z = (character.Position.Z - oldposZ) / timeStep; 288 character._velocity.Z = (character.Position.Z - oldposZ) / timeStep;
287 } 289 }
288 } 290 }
291 return fps;
289 } 292 }
290 293
291 public override void GetResults() 294 public override void GetResults()
diff --git a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
index 5d22eeb..bc28626 100644
--- a/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
+++ b/OpenSim/Region/Physics/PhysXPlugin/PhysXPlugin.cs
@@ -139,8 +139,9 @@ namespace OpenSim.Region.Physics.PhysXPlugin
139 { 139 {
140 140
141 } 141 }
142 public override void Simulate(float timeStep) 142 public override float Simulate(float timeStep)
143 { 143 {
144 float fps = 0f;
144 try 145 try
145 { 146 {
146 foreach (PhysXCharacter actor in _characters) 147 foreach (PhysXCharacter actor in _characters)
@@ -160,6 +161,7 @@ namespace OpenSim.Region.Physics.PhysXPlugin
160 { 161 {
161 Console.WriteLine(e.Message); 162 Console.WriteLine(e.Message);
162 } 163 }
164 return fps;
163 } 165 }
164 166
165 public override void GetResults() 167 public override void GetResults()