diff options
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 78 |
1 files changed, 74 insertions, 4 deletions
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> |