From a1e99642c19810f98084e77723df1e242d2c26d0 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Wed, 25 Jul 2012 22:29:40 +0100 Subject: Add experimental "OpenSim object memory churn" statistics to output of region console "show stats" command This aims to capture the amount of memory that OpenSim turns over whilst operating a region. This memory is not lost - apart from leaks it is reclaimed by the garbage collector. However, the more memory that gets turned over the more work the GC has to do to reclaim it. --- OpenSim/Region/Application/OpenSimBase.cs | 36 ++++++++++++++++--------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'OpenSim/Region/Application/OpenSimBase.cs') diff --git a/OpenSim/Region/Application/OpenSimBase.cs b/OpenSim/Region/Application/OpenSimBase.cs index 3271555..825c4c4 100644 --- a/OpenSim/Region/Application/OpenSimBase.cs +++ b/OpenSim/Region/Application/OpenSimBase.cs @@ -285,7 +285,7 @@ namespace OpenSim private void HandleCommanderCommand(string module, string[] cmd) { - m_sceneManager.SendCommandToPluginModules(cmd); + SceneManager.SendCommandToPluginModules(cmd); } private void HandleCommanderHelp(string module, string[] cmd) @@ -303,7 +303,10 @@ namespace OpenSim // Called from base.StartUp() m_httpServerPort = m_networkServersInfo.HttpListenerPort; - m_sceneManager.OnRestartSim += handleRestartRegion; + SceneManager.OnRestartSim += handleRestartRegion; + + // Only start the memory watchdog once all regions are ready + SceneManager.OnRegionsReadyStatusChange += sm => MemoryWatchdog.Enabled = sm.AllRegionsReady; } /// @@ -412,7 +415,7 @@ namespace OpenSim // scripting engines. scene.CreateScriptInstances(); - m_sceneManager.Add(scene); + SceneManager.Add(scene); if (m_autoCreateClientStack) { @@ -432,7 +435,6 @@ namespace OpenSim mscene = scene; scene.Start(); - scene.StartScripts(); return clientServer; @@ -561,14 +563,14 @@ namespace OpenSim { // only need to check this if we are not at the // root level - if ((m_sceneManager.CurrentScene != null) && - (m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) + if ((SceneManager.CurrentScene != null) && + (SceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) { - m_sceneManager.TrySetCurrentScene(".."); + SceneManager.TrySetCurrentScene(".."); } scene.DeleteAllSceneObjects(); - m_sceneManager.CloseScene(scene); + SceneManager.CloseScene(scene); ShutdownClientServer(scene.RegionInfo); if (!cleanup) @@ -610,7 +612,7 @@ namespace OpenSim public void RemoveRegion(string name, bool cleanUp) { Scene target; - if (m_sceneManager.TryGetScene(name, out target)) + if (SceneManager.TryGetScene(name, out target)) RemoveRegion(target, cleanUp); } @@ -623,13 +625,13 @@ namespace OpenSim { // only need to check this if we are not at the // root level - if ((m_sceneManager.CurrentScene != null) && - (m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) + if ((SceneManager.CurrentScene != null) && + (SceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) { - m_sceneManager.TrySetCurrentScene(".."); + SceneManager.TrySetCurrentScene(".."); } - m_sceneManager.CloseScene(scene); + SceneManager.CloseScene(scene); ShutdownClientServer(scene.RegionInfo); } @@ -641,7 +643,7 @@ namespace OpenSim public void CloseRegion(string name) { Scene target; - if (m_sceneManager.TryGetScene(name, out target)) + if (SceneManager.TryGetScene(name, out target)) CloseRegion(target); } @@ -897,7 +899,7 @@ namespace OpenSim try { - m_sceneManager.Close(); + SceneManager.Close(); } catch (Exception e) { @@ -922,7 +924,7 @@ namespace OpenSim /// The first out parameter describing the number of all the avatars in the Region server public void GetAvatarNumber(out int usernum) { - usernum = m_sceneManager.GetCurrentSceneAvatars().Count; + usernum = SceneManager.GetCurrentSceneAvatars().Count; } /// @@ -931,7 +933,7 @@ namespace OpenSim /// The first out parameter describing the number of regions public void GetRegionNumber(out int regionnum) { - regionnum = m_sceneManager.Scenes.Count; + regionnum = SceneManager.Scenes.Count; } /// -- cgit v1.1