diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 39 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 11 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 35 |
4 files changed, 57 insertions, 60 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 29a54e8..b1755ac 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -137,8 +137,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
137 | protected IDialogModule m_dialogModule; | 137 | protected IDialogModule m_dialogModule; |
138 | protected IEntityTransferModule m_teleportModule; | 138 | protected IEntityTransferModule m_teleportModule; |
139 | protected ICapabilitiesModule m_capsModule; | 139 | protected ICapabilitiesModule m_capsModule; |
140 | // Central Update Loop | ||
141 | protected int m_fps = 10; | ||
142 | 140 | ||
143 | /// <summary> | 141 | /// <summary> |
144 | /// Current scene frame number | 142 | /// Current scene frame number |
@@ -149,8 +147,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
149 | protected set; | 147 | protected set; |
150 | } | 148 | } |
151 | 149 | ||
152 | protected float m_timespan = 0.089f; | 150 | /// <summary> |
153 | protected DateTime m_lastupdate = DateTime.UtcNow; | 151 | /// The minimum length of time in seconds that will be taken for a scene frame. If the frame takes less time then we |
152 | /// will sleep for the remaining period. | ||
153 | /// </summary> | ||
154 | /// <remarks> | ||
155 | /// One can tweak this number to experiment. One current effect of reducing it is to make avatar animations | ||
156 | /// occur too quickly (viewer 1) or with even more slide (viewer 2). | ||
157 | /// </remarks> | ||
158 | protected float m_minFrameTimespan = 0.089f; | ||
159 | |||
160 | /// <summary> | ||
161 | /// The time of the last frame update. | ||
162 | /// </summary> | ||
163 | protected DateTime m_lastFrameUpdate = DateTime.UtcNow; | ||
154 | 164 | ||
155 | // TODO: Possibly stop other classes being able to manipulate this directly. | 165 | // TODO: Possibly stop other classes being able to manipulate this directly. |
156 | private SceneGraph m_sceneGraph; | 166 | private SceneGraph m_sceneGraph; |
@@ -173,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
173 | // private int m_update_land = 1; | 183 | // private int m_update_land = 1; |
174 | private int m_update_coarse_locations = 50; | 184 | private int m_update_coarse_locations = 50; |
175 | 185 | ||
186 | private int agentMS; | ||
176 | private int frameMS; | 187 | private int frameMS; |
177 | private int physicsMS2; | 188 | private int physicsMS2; |
178 | private int physicsMS; | 189 | private int physicsMS; |
@@ -1211,17 +1222,20 @@ namespace OpenSim.Region.Framework.Scenes | |||
1211 | 1222 | ||
1212 | public override void Update() | 1223 | public override void Update() |
1213 | { | 1224 | { |
1214 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastupdate; | 1225 | TimeSpan SinceLastFrame = DateTime.UtcNow - m_lastFrameUpdate; |
1215 | float physicsFPS = 0f; | 1226 | float physicsFPS = 0f; |
1216 | 1227 | ||
1217 | int maintc = Util.EnvironmentTickCount(); | 1228 | int maintc = Util.EnvironmentTickCount(); |
1218 | int tmpFrameMS = maintc; | 1229 | int tmpFrameMS = maintc; |
1219 | tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1230 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1220 | 1231 | ||
1232 | // TODO: ADD AGENT TIME HERE | ||
1221 | // Increment the frame counter | 1233 | // Increment the frame counter |
1222 | ++Frame; | 1234 | ++Frame; |
1223 | try | 1235 | try |
1224 | { | 1236 | { |
1237 | int tmpAgentMS = Util.EnvironmentTickCount(); | ||
1238 | |||
1225 | // Check if any objects have reached their targets | 1239 | // Check if any objects have reached their targets |
1226 | CheckAtTargets(); | 1240 | CheckAtTargets(); |
1227 | 1241 | ||
@@ -1248,6 +1262,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1248 | }); | 1262 | }); |
1249 | } | 1263 | } |
1250 | 1264 | ||
1265 | agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); | ||
1266 | |||
1251 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); | 1267 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); |
1252 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1268 | if ((Frame % m_update_physics == 0) && m_physics_enabled) |
1253 | m_sceneGraph.UpdatePreparePhysics(); | 1269 | m_sceneGraph.UpdatePreparePhysics(); |
@@ -1255,7 +1271,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1255 | 1271 | ||
1256 | // Apply any pending avatar force input to the avatar's velocity | 1272 | // Apply any pending avatar force input to the avatar's velocity |
1257 | if (Frame % m_update_entitymovement == 0) | 1273 | if (Frame % m_update_entitymovement == 0) |
1274 | { | ||
1275 | tmpAgentMS = Util.EnvironmentTickCount(); | ||
1258 | m_sceneGraph.UpdateScenePresenceMovement(); | 1276 | m_sceneGraph.UpdateScenePresenceMovement(); |
1277 | agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); | ||
1278 | } | ||
1259 | 1279 | ||
1260 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their | 1280 | // Perform the main physics update. This will do the actual work of moving objects and avatars according to their |
1261 | // velocity | 1281 | // velocity |
@@ -1263,7 +1283,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1263 | if (Frame % m_update_physics == 0) | 1283 | if (Frame % m_update_physics == 0) |
1264 | { | 1284 | { |
1265 | if (m_physics_enabled) | 1285 | if (m_physics_enabled) |
1266 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_timespan)); | 1286 | physicsFPS = m_sceneGraph.UpdatePhysics(Math.Max(SinceLastFrame.TotalSeconds, m_minFrameTimespan)); |
1267 | if (SynchronizeScene != null) | 1287 | if (SynchronizeScene != null) |
1268 | SynchronizeScene(this); | 1288 | SynchronizeScene(this); |
1269 | } | 1289 | } |
@@ -1320,6 +1340,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1320 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | 1340 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); |
1321 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | 1341 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); |
1322 | StatsReporter.addFrameMS(frameMS); | 1342 | StatsReporter.addFrameMS(frameMS); |
1343 | StatsReporter.addAgentMS(agentMS); | ||
1323 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | 1344 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); |
1324 | StatsReporter.addOtherMS(otherMS); | 1345 | StatsReporter.addOtherMS(otherMS); |
1325 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | 1346 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); |
@@ -1379,11 +1400,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1379 | } | 1400 | } |
1380 | finally | 1401 | finally |
1381 | { | 1402 | { |
1382 | m_lastupdate = DateTime.UtcNow; | 1403 | m_lastFrameUpdate = DateTime.UtcNow; |
1383 | } | 1404 | } |
1384 | 1405 | ||
1385 | maintc = Util.EnvironmentTickCountSubtract(maintc); | 1406 | maintc = Util.EnvironmentTickCountSubtract(maintc); |
1386 | maintc = (int)(m_timespan * 1000) - maintc; | 1407 | maintc = (int)(m_minFrameTimespan * 1000) - maintc; |
1387 | 1408 | ||
1388 | if (maintc > 0) | 1409 | if (maintc > 0) |
1389 | Thread.Sleep(maintc); | 1410 | Thread.Sleep(maintc); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 36c5c52..caec704 100644 --- a/OpenSim/Region/Framework/Scenes/SceneGraph.cs +++ b/OpenSim/Region/Framework/Scenes/SceneGraph.cs | |||
@@ -166,6 +166,12 @@ namespace OpenSim.Region.Framework.Scenes | |||
166 | } | 166 | } |
167 | } | 167 | } |
168 | 168 | ||
169 | /// <summary> | ||
170 | /// Update the position of all the scene presences. | ||
171 | /// </summary> | ||
172 | /// <remarks> | ||
173 | /// Called only from the main scene loop. | ||
174 | /// </remarks> | ||
169 | protected internal void UpdatePresences() | 175 | protected internal void UpdatePresences() |
170 | { | 176 | { |
171 | ForEachScenePresence(delegate(ScenePresence presence) | 177 | ForEachScenePresence(delegate(ScenePresence presence) |
@@ -174,6 +180,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
174 | }); | 180 | }); |
175 | } | 181 | } |
176 | 182 | ||
183 | /// <summary> | ||
184 | /// Perform a physics frame update. | ||
185 | /// </summary> | ||
186 | /// <param name="elapsed"></param> | ||
187 | /// <returns></returns> | ||
177 | protected internal float UpdatePhysics(double elapsed) | 188 | protected internal float UpdatePhysics(double elapsed) |
178 | { | 189 | { |
179 | lock (m_syncRoot) | 190 | lock (m_syncRoot) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 0290576..ce63946 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -870,11 +870,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
870 | /// </summary> | 870 | /// </summary> |
871 | public void SendPrimUpdates() | 871 | public void SendPrimUpdates() |
872 | { | 872 | { |
873 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
874 | |||
875 | SceneViewer.SendPrimUpdates(); | 873 | SceneViewer.SendPrimUpdates(); |
876 | |||
877 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
878 | } | 874 | } |
879 | 875 | ||
880 | #region Status Methods | 876 | #region Status Methods |
@@ -1276,7 +1272,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1276 | // return; | 1272 | // return; |
1277 | //} | 1273 | //} |
1278 | 1274 | ||
1279 | m_perfMonMS = Util.EnvironmentTickCount(); | 1275 | // m_perfMonMS = Util.EnvironmentTickCount(); |
1280 | 1276 | ||
1281 | ++m_movementUpdateCount; | 1277 | ++m_movementUpdateCount; |
1282 | if (m_movementUpdateCount < 1) | 1278 | if (m_movementUpdateCount < 1) |
@@ -1565,7 +1561,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1565 | 1561 | ||
1566 | m_scene.EventManager.TriggerOnClientMovement(this); | 1562 | m_scene.EventManager.TriggerOnClientMovement(this); |
1567 | 1563 | ||
1568 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 1564 | // It doesn't make sense to add this to frame stats as this update is processed indepedently of the scene loop |
1565 | // m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
1569 | } | 1566 | } |
1570 | 1567 | ||
1571 | /// <summary> | 1568 | /// <summary> |
@@ -2341,8 +2338,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2341 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> | 2338 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> |
2342 | public void AddNewMovement(Vector3 vec) | 2339 | public void AddNewMovement(Vector3 vec) |
2343 | { | 2340 | { |
2344 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2345 | |||
2346 | Vector3 direc = vec * Rotation; | 2341 | Vector3 direc = vec * Rotation; |
2347 | direc.Normalize(); | 2342 | direc.Normalize(); |
2348 | 2343 | ||
@@ -2379,8 +2374,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2379 | 2374 | ||
2380 | // TODO: Add the force instead of only setting it to support multiple forces per frame? | 2375 | // TODO: Add the force instead of only setting it to support multiple forces per frame? |
2381 | m_forceToApply = direc; | 2376 | m_forceToApply = direc; |
2382 | |||
2383 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2384 | } | 2377 | } |
2385 | 2378 | ||
2386 | #endregion | 2379 | #endregion |
@@ -2443,8 +2436,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2443 | // server. | 2436 | // server. |
2444 | if (remoteClient.IsActive) | 2437 | if (remoteClient.IsActive) |
2445 | { | 2438 | { |
2446 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2447 | |||
2448 | Vector3 pos = m_pos; | 2439 | Vector3 pos = m_pos; |
2449 | pos.Z += Appearance.HipOffset; | 2440 | pos.Z += Appearance.HipOffset; |
2450 | 2441 | ||
@@ -2455,7 +2446,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2455 | PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | 2446 | PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity |
2456 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); | 2447 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); |
2457 | 2448 | ||
2458 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2459 | m_scene.StatsReporter.AddAgentUpdates(1); | 2449 | m_scene.StatsReporter.AddAgentUpdates(1); |
2460 | } | 2450 | } |
2461 | } | 2451 | } |
@@ -2496,14 +2486,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2496 | || Math.Abs(distanceError) > distanceErrorThreshold | 2486 | || Math.Abs(distanceError) > distanceErrorThreshold |
2497 | || velocidyDiff > 0.01f) // did velocity change from last update? | 2487 | || velocidyDiff > 0.01f) // did velocity change from last update? |
2498 | { | 2488 | { |
2499 | m_perfMonMS = currentTick; | ||
2500 | lastVelocitySentToAllClients = Velocity; | 2489 | lastVelocitySentToAllClients = Velocity; |
2501 | lastTerseUpdateToAllClientsTick = currentTick; | 2490 | lastTerseUpdateToAllClientsTick = currentTick; |
2502 | lastPositionSentToAllClients = OffsetPosition; | 2491 | lastPositionSentToAllClients = OffsetPosition; |
2503 | 2492 | ||
2504 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2493 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2505 | |||
2506 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2507 | } | 2494 | } |
2508 | } | 2495 | } |
2509 | 2496 | ||
@@ -2524,9 +2511,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2524 | 2511 | ||
2525 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2512 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
2526 | { | 2513 | { |
2527 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2528 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); | 2514 | ControllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); |
2529 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2530 | } | 2515 | } |
2531 | 2516 | ||
2532 | /// <summary> | 2517 | /// <summary> |
@@ -2587,8 +2572,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2587 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); | 2572 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); |
2588 | return; | 2573 | return; |
2589 | } | 2574 | } |
2590 | |||
2591 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2592 | 2575 | ||
2593 | int count = 0; | 2576 | int count = 0; |
2594 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2577 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2598,7 +2581,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2598 | }); | 2581 | }); |
2599 | 2582 | ||
2600 | m_scene.StatsReporter.AddAgentUpdates(count); | 2583 | m_scene.StatsReporter.AddAgentUpdates(count); |
2601 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2602 | } | 2584 | } |
2603 | 2585 | ||
2604 | /// <summary> | 2586 | /// <summary> |
@@ -2607,8 +2589,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2607 | /// </summary> | 2589 | /// </summary> |
2608 | public void SendOtherAgentsAvatarDataToMe() | 2590 | public void SendOtherAgentsAvatarDataToMe() |
2609 | { | 2591 | { |
2610 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2611 | |||
2612 | int count = 0; | 2592 | int count = 0; |
2613 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2593 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2614 | { | 2594 | { |
@@ -2625,7 +2605,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2625 | }); | 2605 | }); |
2626 | 2606 | ||
2627 | m_scene.StatsReporter.AddAgentUpdates(count); | 2607 | m_scene.StatsReporter.AddAgentUpdates(count); |
2628 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2629 | } | 2608 | } |
2630 | 2609 | ||
2631 | /// <summary> | 2610 | /// <summary> |
@@ -2654,8 +2633,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2654 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); | 2633 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); |
2655 | return; | 2634 | return; |
2656 | } | 2635 | } |
2657 | |||
2658 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2659 | 2636 | ||
2660 | int count = 0; | 2637 | int count = 0; |
2661 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2638 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2668,7 +2645,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2668 | }); | 2645 | }); |
2669 | 2646 | ||
2670 | m_scene.StatsReporter.AddAgentUpdates(count); | 2647 | m_scene.StatsReporter.AddAgentUpdates(count); |
2671 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2672 | } | 2648 | } |
2673 | 2649 | ||
2674 | /// <summary> | 2650 | /// <summary> |
@@ -2678,7 +2654,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2678 | public void SendOtherAgentsAppearanceToMe() | 2654 | public void SendOtherAgentsAppearanceToMe() |
2679 | { | 2655 | { |
2680 | //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); | 2656 | //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); |
2681 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2682 | 2657 | ||
2683 | int count = 0; | 2658 | int count = 0; |
2684 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2659 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2696,7 +2671,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2696 | }); | 2671 | }); |
2697 | 2672 | ||
2698 | m_scene.StatsReporter.AddAgentUpdates(count); | 2673 | m_scene.StatsReporter.AddAgentUpdates(count); |
2699 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2700 | } | 2674 | } |
2701 | 2675 | ||
2702 | /// <summary> | 2676 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 87dcdee..282b677 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -37,6 +37,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
37 | { | 37 | { |
38 | public class SimStatsReporter | 38 | public class SimStatsReporter |
39 | { | 39 | { |
40 | // private static readonly log4net.ILog m_log | ||
41 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
42 | |||
40 | public delegate void SendStatResult(SimStats stats); | 43 | public delegate void SendStatResult(SimStats stats); |
41 | 44 | ||
42 | public delegate void YourStatsAreWrong(); | 45 | public delegate void YourStatsAreWrong(); |
@@ -165,18 +168,9 @@ namespace OpenSim.Region.Framework.Scenes | |||
165 | 168 | ||
166 | #region various statistic googly moogly | 169 | #region various statistic googly moogly |
167 | 170 | ||
168 | // Our FPS is actually 10fps, so multiplying by 5 to get the amount that people expect there | ||
169 | // 0-50 is pretty close to 0-45 | ||
170 | float simfps = (int) ((m_fps * 5)); | ||
171 | // save the reported value so there is something available for llGetRegionFPS | 171 | // save the reported value so there is something available for llGetRegionFPS |
172 | lastReportedSimFPS = (float)simfps / statsUpdateFactor; | 172 | lastReportedSimFPS = (float)m_fps / statsUpdateFactor; |
173 | |||
174 | //if (simfps > 45) | ||
175 | //simfps = simfps - (simfps - 45); | ||
176 | //if (simfps < 0) | ||
177 | //simfps = 0; | ||
178 | 173 | ||
179 | // | ||
180 | float physfps = ((m_pfps / 1000)); | 174 | float physfps = ((m_pfps / 1000)); |
181 | 175 | ||
182 | //if (physfps > 600) | 176 | //if (physfps > 600) |
@@ -197,7 +191,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
197 | // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change | 191 | // 'statsUpdateFactor' is how often stats packets are sent in seconds. Used below to change |
198 | // values to X-per-second values. | 192 | // values to X-per-second values. |
199 | 193 | ||
200 | for (int i = 0; i<21;i++) | 194 | for (int i = 0; i < 21; i++) |
201 | { | 195 | { |
202 | sb[i] = new SimStatsPacket.StatBlock(); | 196 | sb[i] = new SimStatsPacket.StatBlock(); |
203 | } | 197 | } |
@@ -206,7 +200,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
206 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); | 200 | sb[0].StatValue = (Single.IsNaN(m_timeDilation)) ? 0.1f : m_timeDilation ; //((((m_timeDilation + (0.10f * statsUpdateFactor)) /10) / statsUpdateFactor)); |
207 | 201 | ||
208 | sb[1].StatID = (uint) Stats.SimFPS; | 202 | sb[1].StatID = (uint) Stats.SimFPS; |
209 | sb[1].StatValue = simfps/statsUpdateFactor; | 203 | sb[1].StatValue = m_fps/statsUpdateFactor; |
210 | 204 | ||
211 | sb[2].StatID = (uint) Stats.PhysicsFPS; | 205 | sb[2].StatID = (uint) Stats.PhysicsFPS; |
212 | sb[2].StatValue = physfps / statsUpdateFactor; | 206 | sb[2].StatValue = physfps / statsUpdateFactor; |
@@ -272,7 +266,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
272 | 266 | ||
273 | SimStats simStats | 267 | SimStats simStats |
274 | = new SimStats( | 268 | = new SimStats( |
275 | ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, rb, sb, m_scene.RegionInfo.originRegionID); | 269 | ReportingRegion.RegionLocX, ReportingRegion.RegionLocY, regionFlags, (uint)m_objectCapacity, |
270 | rb, sb, m_scene.RegionInfo.originRegionID); | ||
276 | 271 | ||
277 | handlerSendStatResult = OnSendStatsResult; | 272 | handlerSendStatResult = OnSendStatsResult; |
278 | if (handlerSendStatResult != null) | 273 | if (handlerSendStatResult != null) |
@@ -395,30 +390,32 @@ namespace OpenSim.Region.Framework.Scenes | |||
395 | { | 390 | { |
396 | m_frameMS += ms; | 391 | m_frameMS += ms; |
397 | } | 392 | } |
393 | |||
398 | public void addNetMS(int ms) | 394 | public void addNetMS(int ms) |
399 | { | 395 | { |
400 | m_netMS += ms; | 396 | m_netMS += ms; |
401 | } | 397 | } |
398 | |||
402 | public void addAgentMS(int ms) | 399 | public void addAgentMS(int ms) |
403 | { | 400 | { |
404 | m_agentMS += ms; | 401 | m_agentMS += ms; |
405 | } | 402 | } |
403 | |||
406 | public void addPhysicsMS(int ms) | 404 | public void addPhysicsMS(int ms) |
407 | { | 405 | { |
408 | m_physicsMS += ms; | 406 | m_physicsMS += ms; |
409 | } | 407 | } |
408 | |||
410 | public void addImageMS(int ms) | 409 | public void addImageMS(int ms) |
411 | { | 410 | { |
412 | m_imageMS += ms; | 411 | m_imageMS += ms; |
413 | } | 412 | } |
413 | |||
414 | public void addOtherMS(int ms) | 414 | public void addOtherMS(int ms) |
415 | { | 415 | { |
416 | m_otherMS += ms; | 416 | m_otherMS += ms; |
417 | } | 417 | } |
418 | 418 | ||
419 | // private static readonly log4net.ILog m_log | ||
420 | // = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); | ||
421 | |||
422 | public void AddPendingDownloads(int count) | 419 | public void AddPendingDownloads(int count) |
423 | { | 420 | { |
424 | m_pendingDownloads += count; | 421 | m_pendingDownloads += count; |
@@ -455,12 +452,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
455 | AddOutPackets(outPackets); | 452 | AddOutPackets(outPackets); |
456 | AddunAckedBytes(unAckedBytes); | 453 | AddunAckedBytes(unAckedBytes); |
457 | } | 454 | } |
458 | |||
459 | public void AddAgentTime(int ms) | ||
460 | { | ||
461 | addFrameMS(ms); | ||
462 | addAgentMS(ms); | ||
463 | } | ||
464 | 455 | ||
465 | #endregion | 456 | #endregion |
466 | } | 457 | } |