aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Framework/Scenes/ScenePresence.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-10-06 00:45:25 +0100
committerJustin Clark-Casey (justincc)2011-10-06 00:45:25 +0100
commitca83f99332316fda1c412a5bf2889f9cf5cf3577 (patch)
treea1789f55d048ef3bc7dd99adf524125cb34f0efd /OpenSim/Region/Framework/Scenes/ScenePresence.cs
parentrename WebStatsModules.m_scene to m_scenes since it's a list of scenes, not a... (diff)
downloadopensim-SC_OLD-ca83f99332316fda1c412a5bf2889f9cf5cf3577.zip
opensim-SC_OLD-ca83f99332316fda1c412a5bf2889f9cf5cf3577.tar.gz
opensim-SC_OLD-ca83f99332316fda1c412a5bf2889f9cf5cf3577.tar.bz2
opensim-SC_OLD-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/ScenePresence.cs32
1 files changed, 3 insertions, 29 deletions
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>