diff options
author | Justin Clark-Casey (justincc) | 2011-10-06 00:45:25 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2011-10-06 00:45:25 +0100 |
commit | ca83f99332316fda1c412a5bf2889f9cf5cf3577 (patch) | |
tree | a1789f55d048ef3bc7dd99adf524125cb34f0efd /OpenSim | |
parent | rename WebStatsModules.m_scene to m_scenes since it's a list of scenes, not a... (diff) | |
download | opensim-SC-ca83f99332316fda1c412a5bf2889f9cf5cf3577.zip opensim-SC-ca83f99332316fda1c412a5bf2889f9cf5cf3577.tar.gz opensim-SC-ca83f99332316fda1c412a5bf2889f9cf5cf3577.tar.bz2 opensim-SC-ca83f99332316fda1c412a5bf2889f9cf5cf3577.tar.xz |
Instead of adding stat agentMS in all kinds of places, calculate it instead in the main Scene.Update() loop, like the other stats
Some of the places where agentMS was added were in separate threads launched by the update loop. I don't believe this is correct, since such threads are no longer contributing to frame time.
Some of the places were also driven by client input rather than the scene loop. I don't believe it's appropriate to add this kind of stuff to scene loop stats.
These changes hopefully have the nice affect of making the broken out frame stats actually add up to the total frame time
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 13 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SceneGraph.cs | 6 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 32 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | 6 |
4 files changed, 21 insertions, 36 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index e4ebcff..b1755ac 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -183,6 +183,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
183 | // private int m_update_land = 1; | 183 | // private int m_update_land = 1; |
184 | private int m_update_coarse_locations = 50; | 184 | private int m_update_coarse_locations = 50; |
185 | 185 | ||
186 | private int agentMS; | ||
186 | private int frameMS; | 187 | private int frameMS; |
187 | private int physicsMS2; | 188 | private int physicsMS2; |
188 | private int physicsMS; | 189 | private int physicsMS; |
@@ -1226,12 +1227,15 @@ namespace OpenSim.Region.Framework.Scenes | |||
1226 | 1227 | ||
1227 | int maintc = Util.EnvironmentTickCount(); | 1228 | int maintc = Util.EnvironmentTickCount(); |
1228 | int tmpFrameMS = maintc; | 1229 | int tmpFrameMS = maintc; |
1229 | tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; | 1230 | agentMS = tempOnRezMS = eventMS = backupMS = terrainMS = landMS = 0; |
1230 | 1231 | ||
1232 | // TODO: ADD AGENT TIME HERE | ||
1231 | // Increment the frame counter | 1233 | // Increment the frame counter |
1232 | ++Frame; | 1234 | ++Frame; |
1233 | try | 1235 | try |
1234 | { | 1236 | { |
1237 | int tmpAgentMS = Util.EnvironmentTickCount(); | ||
1238 | |||
1235 | // Check if any objects have reached their targets | 1239 | // Check if any objects have reached their targets |
1236 | CheckAtTargets(); | 1240 | CheckAtTargets(); |
1237 | 1241 | ||
@@ -1258,6 +1262,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1258 | }); | 1262 | }); |
1259 | } | 1263 | } |
1260 | 1264 | ||
1265 | agentMS = Util.EnvironmentTickCountSubtract(tmpAgentMS); | ||
1266 | |||
1261 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); | 1267 | int tmpPhysicsMS2 = Util.EnvironmentTickCount(); |
1262 | if ((Frame % m_update_physics == 0) && m_physics_enabled) | 1268 | if ((Frame % m_update_physics == 0) && m_physics_enabled) |
1263 | m_sceneGraph.UpdatePreparePhysics(); | 1269 | m_sceneGraph.UpdatePreparePhysics(); |
@@ -1265,7 +1271,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
1265 | 1271 | ||
1266 | // Apply any pending avatar force input to the avatar's velocity | 1272 | // Apply any pending avatar force input to the avatar's velocity |
1267 | if (Frame % m_update_entitymovement == 0) | 1273 | if (Frame % m_update_entitymovement == 0) |
1274 | { | ||
1275 | tmpAgentMS = Util.EnvironmentTickCount(); | ||
1268 | m_sceneGraph.UpdateScenePresenceMovement(); | 1276 | m_sceneGraph.UpdateScenePresenceMovement(); |
1277 | agentMS += Util.EnvironmentTickCountSubtract(tmpAgentMS); | ||
1278 | } | ||
1269 | 1279 | ||
1270 | // 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 |
1271 | // velocity | 1281 | // velocity |
@@ -1330,6 +1340,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1330 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); | 1340 | StatsReporter.SetObjects(m_sceneGraph.GetTotalObjectsCount()); |
1331 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); | 1341 | StatsReporter.SetActiveObjects(m_sceneGraph.GetActiveObjectsCount()); |
1332 | StatsReporter.addFrameMS(frameMS); | 1342 | StatsReporter.addFrameMS(frameMS); |
1343 | StatsReporter.addAgentMS(agentMS); | ||
1333 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); | 1344 | StatsReporter.addPhysicsMS(physicsMS + physicsMS2); |
1334 | StatsReporter.addOtherMS(otherMS); | 1345 | StatsReporter.addOtherMS(otherMS); |
1335 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); | 1346 | StatsReporter.SetActiveScripts(m_sceneGraph.GetActiveScriptsCount()); |
diff --git a/OpenSim/Region/Framework/Scenes/SceneGraph.cs b/OpenSim/Region/Framework/Scenes/SceneGraph.cs index 11c2a78..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) |
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index b3e04be..f049b78 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -847,11 +847,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
847 | /// </summary> | 847 | /// </summary> |
848 | public void SendPrimUpdates() | 848 | public void SendPrimUpdates() |
849 | { | 849 | { |
850 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
851 | |||
852 | m_sceneViewer.SendPrimUpdates(); | 850 | m_sceneViewer.SendPrimUpdates(); |
853 | |||
854 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
855 | } | 851 | } |
856 | 852 | ||
857 | #region Status Methods | 853 | #region Status Methods |
@@ -1253,7 +1249,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1253 | // return; | 1249 | // return; |
1254 | //} | 1250 | //} |
1255 | 1251 | ||
1256 | m_perfMonMS = Util.EnvironmentTickCount(); | 1252 | // m_perfMonMS = Util.EnvironmentTickCount(); |
1257 | 1253 | ||
1258 | ++m_movementUpdateCount; | 1254 | ++m_movementUpdateCount; |
1259 | if (m_movementUpdateCount < 1) | 1255 | if (m_movementUpdateCount < 1) |
@@ -1545,7 +1541,8 @@ namespace OpenSim.Region.Framework.Scenes | |||
1545 | 1541 | ||
1546 | m_scene.EventManager.TriggerOnClientMovement(this); | 1542 | m_scene.EventManager.TriggerOnClientMovement(this); |
1547 | 1543 | ||
1548 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | 1544 | // It doesn't make sense to add this to frame stats as this update is processed indepedently of the scene loop |
1545 | // m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
1549 | } | 1546 | } |
1550 | 1547 | ||
1551 | /// <summary> | 1548 | /// <summary> |
@@ -2325,8 +2322,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2325 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> | 2322 | /// <param name="vec">The vector in which to move. This is relative to the rotation argument</param> |
2326 | public void AddNewMovement(Vector3 vec) | 2323 | public void AddNewMovement(Vector3 vec) |
2327 | { | 2324 | { |
2328 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2329 | |||
2330 | Vector3 direc = vec * Rotation; | 2325 | Vector3 direc = vec * Rotation; |
2331 | direc.Normalize(); | 2326 | direc.Normalize(); |
2332 | 2327 | ||
@@ -2365,8 +2360,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2365 | 2360 | ||
2366 | // TODO: Add the force instead of only setting it to support multiple forces per frame? | 2361 | // TODO: Add the force instead of only setting it to support multiple forces per frame? |
2367 | m_forceToApply = direc; | 2362 | m_forceToApply = direc; |
2368 | |||
2369 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2370 | } | 2363 | } |
2371 | 2364 | ||
2372 | #endregion | 2365 | #endregion |
@@ -2431,8 +2424,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2431 | // server. | 2424 | // server. |
2432 | if (remoteClient.IsActive) | 2425 | if (remoteClient.IsActive) |
2433 | { | 2426 | { |
2434 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2435 | |||
2436 | Vector3 pos = m_pos; | 2427 | Vector3 pos = m_pos; |
2437 | pos.Z += m_appearance.HipOffset; | 2428 | pos.Z += m_appearance.HipOffset; |
2438 | 2429 | ||
@@ -2443,7 +2434,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2443 | PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity | 2434 | PrimUpdateFlags.Position | PrimUpdateFlags.Rotation | PrimUpdateFlags.Velocity |
2444 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); | 2435 | | PrimUpdateFlags.Acceleration | PrimUpdateFlags.AngularVelocity); |
2445 | 2436 | ||
2446 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2447 | m_scene.StatsReporter.AddAgentUpdates(1); | 2437 | m_scene.StatsReporter.AddAgentUpdates(1); |
2448 | } | 2438 | } |
2449 | } | 2439 | } |
@@ -2484,14 +2474,11 @@ namespace OpenSim.Region.Framework.Scenes | |||
2484 | || Math.Abs(distanceError) > distanceErrorThreshold | 2474 | || Math.Abs(distanceError) > distanceErrorThreshold |
2485 | || velocidyDiff > 0.01f) // did velocity change from last update? | 2475 | || velocidyDiff > 0.01f) // did velocity change from last update? |
2486 | { | 2476 | { |
2487 | m_perfMonMS = currentTick; | ||
2488 | lastVelocitySentToAllClients = Velocity; | 2477 | lastVelocitySentToAllClients = Velocity; |
2489 | lastTerseUpdateToAllClientsTick = currentTick; | 2478 | lastTerseUpdateToAllClientsTick = currentTick; |
2490 | lastPositionSentToAllClients = OffsetPosition; | 2479 | lastPositionSentToAllClients = OffsetPosition; |
2491 | 2480 | ||
2492 | m_scene.ForEachClient(SendTerseUpdateToClient); | 2481 | m_scene.ForEachClient(SendTerseUpdateToClient); |
2493 | |||
2494 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2495 | } | 2482 | } |
2496 | } | 2483 | } |
2497 | 2484 | ||
@@ -2512,9 +2499,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
2512 | 2499 | ||
2513 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) | 2500 | public void SendCoarseLocationsDefault(UUID sceneId, ScenePresence p, List<Vector3> coarseLocations, List<UUID> avatarUUIDs) |
2514 | { | 2501 | { |
2515 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2516 | m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); | 2502 | m_controllingClient.SendCoarseLocationUpdate(avatarUUIDs, coarseLocations); |
2517 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2518 | } | 2503 | } |
2519 | 2504 | ||
2520 | /// <summary> | 2505 | /// <summary> |
@@ -2575,8 +2560,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2575 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); | 2560 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); |
2576 | return; | 2561 | return; |
2577 | } | 2562 | } |
2578 | |||
2579 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2580 | 2563 | ||
2581 | int count = 0; | 2564 | int count = 0; |
2582 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2565 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2586,7 +2569,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2586 | }); | 2569 | }); |
2587 | 2570 | ||
2588 | m_scene.StatsReporter.AddAgentUpdates(count); | 2571 | m_scene.StatsReporter.AddAgentUpdates(count); |
2589 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2590 | } | 2572 | } |
2591 | 2573 | ||
2592 | /// <summary> | 2574 | /// <summary> |
@@ -2595,8 +2577,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2595 | /// </summary> | 2577 | /// </summary> |
2596 | public void SendOtherAgentsAvatarDataToMe() | 2578 | public void SendOtherAgentsAvatarDataToMe() |
2597 | { | 2579 | { |
2598 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2599 | |||
2600 | int count = 0; | 2580 | int count = 0; |
2601 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2581 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
2602 | { | 2582 | { |
@@ -2613,7 +2593,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2613 | }); | 2593 | }); |
2614 | 2594 | ||
2615 | m_scene.StatsReporter.AddAgentUpdates(count); | 2595 | m_scene.StatsReporter.AddAgentUpdates(count); |
2616 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2617 | } | 2596 | } |
2618 | 2597 | ||
2619 | /// <summary> | 2598 | /// <summary> |
@@ -2642,8 +2621,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2642 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); | 2621 | m_log.Warn("[SCENE PRESENCE] attempt to send avatar data from a child agent"); |
2643 | return; | 2622 | return; |
2644 | } | 2623 | } |
2645 | |||
2646 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2647 | 2624 | ||
2648 | int count = 0; | 2625 | int count = 0; |
2649 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2626 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2656,7 +2633,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2656 | }); | 2633 | }); |
2657 | 2634 | ||
2658 | m_scene.StatsReporter.AddAgentUpdates(count); | 2635 | m_scene.StatsReporter.AddAgentUpdates(count); |
2659 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2660 | } | 2636 | } |
2661 | 2637 | ||
2662 | /// <summary> | 2638 | /// <summary> |
@@ -2666,7 +2642,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2666 | public void SendOtherAgentsAppearanceToMe() | 2642 | public void SendOtherAgentsAppearanceToMe() |
2667 | { | 2643 | { |
2668 | //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); | 2644 | //m_log.DebugFormat("[SCENE PRESENCE] SendOtherAgentsAppearanceToMe: {0} ({1})", Name, UUID); |
2669 | m_perfMonMS = Util.EnvironmentTickCount(); | ||
2670 | 2645 | ||
2671 | int count = 0; | 2646 | int count = 0; |
2672 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) | 2647 | m_scene.ForEachScenePresence(delegate(ScenePresence scenePresence) |
@@ -2684,7 +2659,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
2684 | }); | 2659 | }); |
2685 | 2660 | ||
2686 | m_scene.StatsReporter.AddAgentUpdates(count); | 2661 | m_scene.StatsReporter.AddAgentUpdates(count); |
2687 | m_scene.StatsReporter.AddAgentTime(Util.EnvironmentTickCountSubtract(m_perfMonMS)); | ||
2688 | } | 2662 | } |
2689 | 2663 | ||
2690 | /// <summary> | 2664 | /// <summary> |
diff --git a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs index 2d92ed8..282b677 100644 --- a/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs +++ b/OpenSim/Region/Framework/Scenes/SimStatsReporter.cs | |||
@@ -452,12 +452,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
452 | AddOutPackets(outPackets); | 452 | AddOutPackets(outPackets); |
453 | AddunAckedBytes(unAckedBytes); | 453 | AddunAckedBytes(unAckedBytes); |
454 | } | 454 | } |
455 | |||
456 | public void AddAgentTime(int ms) | ||
457 | { | ||
458 | addFrameMS(ms); | ||
459 | addAgentMS(ms); | ||
460 | } | ||
461 | 455 | ||
462 | #endregion | 456 | #endregion |
463 | } | 457 | } |