aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Application/OpenSim.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2012-07-25 22:29:40 +0100
committerJustin Clark-Casey (justincc)2012-07-25 22:29:40 +0100
commita1e99642c19810f98084e77723df1e242d2c26d0 (patch)
tree24884797a683355fa862621310d82f37067c7813 /OpenSim/Region/Application/OpenSim.cs
parentMake SceneManager.OnRegionsReadyStatusChange event available. (diff)
downloadopensim-SC-a1e99642c19810f98084e77723df1e242d2c26d0.zip
opensim-SC-a1e99642c19810f98084e77723df1e242d2c26d0.tar.gz
opensim-SC-a1e99642c19810f98084e77723df1e242d2c26d0.tar.bz2
opensim-SC-a1e99642c19810f98084e77723df1e242d2c26d0.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Application/OpenSim.cs72
1 files changed, 36 insertions, 36 deletions
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs
index a4d85ac..f68974c 100644
--- a/OpenSim/Region/Application/OpenSim.cs
+++ b/OpenSim/Region/Application/OpenSim.cs
@@ -200,9 +200,9 @@ namespace OpenSim
200 PrintFileToConsole("startuplogo.txt"); 200 PrintFileToConsole("startuplogo.txt");
201 201
202 // For now, start at the 'root' level by default 202 // For now, start at the 'root' level by default
203 if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it 203 if (SceneManager.Scenes.Count == 1) // If there is only one region, select it
204 ChangeSelectedRegion("region", 204 ChangeSelectedRegion("region",
205 new string[] {"change", "region", m_sceneManager.Scenes[0].RegionInfo.RegionName}); 205 new string[] {"change", "region", SceneManager.Scenes[0].RegionInfo.RegionName});
206 else 206 else
207 ChangeSelectedRegion("region", new string[] {"change", "region", "root"}); 207 ChangeSelectedRegion("region", new string[] {"change", "region", "root"});
208 208
@@ -461,7 +461,7 @@ namespace OpenSim
461 if (cmdparams.Length > 4) 461 if (cmdparams.Length > 4)
462 alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4)); 462 alert = String.Format("\n{0}\n", String.Join(" ", cmdparams, 4, cmdparams.Length - 4));
463 463
464 IList agents = m_sceneManager.GetCurrentSceneAvatars(); 464 IList agents = SceneManager.GetCurrentSceneAvatars();
465 465
466 foreach (ScenePresence presence in agents) 466 foreach (ScenePresence presence in agents)
467 { 467 {
@@ -542,7 +542,7 @@ namespace OpenSim
542 private void HandleForceUpdate(string module, string[] args) 542 private void HandleForceUpdate(string module, string[] args)
543 { 543 {
544 MainConsole.Instance.Output("Updating all clients"); 544 MainConsole.Instance.Output("Updating all clients");
545 m_sceneManager.ForceCurrentSceneClientUpdate(); 545 SceneManager.ForceCurrentSceneClientUpdate();
546 } 546 }
547 547
548 /// <summary> 548 /// <summary>
@@ -554,7 +554,7 @@ namespace OpenSim
554 { 554 {
555 if (args.Length == 6) 555 if (args.Length == 6)
556 { 556 {
557 m_sceneManager.HandleEditCommandOnCurrentScene(args); 557 SceneManager.HandleEditCommandOnCurrentScene(args);
558 } 558 }
559 else 559 else
560 { 560 {
@@ -765,7 +765,7 @@ namespace OpenSim
765 case "load": 765 case "load":
766 if (cmdparams.Length > 1) 766 if (cmdparams.Length > 1)
767 { 767 {
768 foreach (Scene s in new ArrayList(m_sceneManager.Scenes)) 768 foreach (Scene s in new ArrayList(SceneManager.Scenes))
769 { 769 {
770 MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1])); 770 MainConsole.Instance.Output(String.Format("Loading module: {0}", cmdparams[1]));
771 m_moduleLoader.LoadRegionModules(cmdparams[1], s); 771 m_moduleLoader.LoadRegionModules(cmdparams[1], s);
@@ -803,14 +803,14 @@ namespace OpenSim
803 803
804 case "backup": 804 case "backup":
805 MainConsole.Instance.Output("Triggering save of pending object updates to persistent store"); 805 MainConsole.Instance.Output("Triggering save of pending object updates to persistent store");
806 m_sceneManager.BackupCurrentScene(); 806 SceneManager.BackupCurrentScene();
807 break; 807 break;
808 808
809 case "remove-region": 809 case "remove-region":
810 string regRemoveName = CombineParams(cmdparams, 0); 810 string regRemoveName = CombineParams(cmdparams, 0);
811 811
812 Scene removeScene; 812 Scene removeScene;
813 if (m_sceneManager.TryGetScene(regRemoveName, out removeScene)) 813 if (SceneManager.TryGetScene(regRemoveName, out removeScene))
814 RemoveRegion(removeScene, false); 814 RemoveRegion(removeScene, false);
815 else 815 else
816 MainConsole.Instance.Output("No region with that name"); 816 MainConsole.Instance.Output("No region with that name");
@@ -820,14 +820,14 @@ namespace OpenSim
820 string regDeleteName = CombineParams(cmdparams, 0); 820 string regDeleteName = CombineParams(cmdparams, 0);
821 821
822 Scene killScene; 822 Scene killScene;
823 if (m_sceneManager.TryGetScene(regDeleteName, out killScene)) 823 if (SceneManager.TryGetScene(regDeleteName, out killScene))
824 RemoveRegion(killScene, true); 824 RemoveRegion(killScene, true);
825 else 825 else
826 MainConsole.Instance.Output("no region with that name"); 826 MainConsole.Instance.Output("no region with that name");
827 break; 827 break;
828 828
829 case "restart": 829 case "restart":
830 m_sceneManager.RestartCurrentScene(); 830 SceneManager.RestartCurrentScene();
831 break; 831 break;
832 } 832 }
833 } 833 }
@@ -842,7 +842,7 @@ namespace OpenSim
842 { 842 {
843 string newRegionName = CombineParams(cmdparams, 2); 843 string newRegionName = CombineParams(cmdparams, 2);
844 844
845 if (!m_sceneManager.TrySetCurrentScene(newRegionName)) 845 if (!SceneManager.TrySetCurrentScene(newRegionName))
846 MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName)); 846 MainConsole.Instance.Output(String.Format("Couldn't select region {0}", newRegionName));
847 } 847 }
848 else 848 else
@@ -850,7 +850,7 @@ namespace OpenSim
850 MainConsole.Instance.Output("Usage: change region <region name>"); 850 MainConsole.Instance.Output("Usage: change region <region name>");
851 } 851 }
852 852
853 string regionName = (m_sceneManager.CurrentScene == null ? "root" : m_sceneManager.CurrentScene.RegionInfo.RegionName); 853 string regionName = (SceneManager.CurrentScene == null ? "root" : SceneManager.CurrentScene.RegionInfo.RegionName);
854 MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName)); 854 MainConsole.Instance.Output(String.Format("Currently selected region is {0}", regionName));
855 855
856// m_log.DebugFormat("Original prompt is {0}", m_consolePrompt); 856// m_log.DebugFormat("Original prompt is {0}", m_consolePrompt);
@@ -868,7 +868,7 @@ namespace OpenSim
868 }); 868 });
869 869
870 m_console.DefaultPrompt = prompt; 870 m_console.DefaultPrompt = prompt;
871 m_console.ConsoleScene = m_sceneManager.CurrentScene; 871 m_console.ConsoleScene = SceneManager.CurrentScene;
872 } 872 }
873 873
874 /// <summary> 874 /// <summary>
@@ -892,7 +892,7 @@ namespace OpenSim
892 int newDebug; 892 int newDebug;
893 if (int.TryParse(args[2], out newDebug)) 893 if (int.TryParse(args[2], out newDebug))
894 { 894 {
895 m_sceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name); 895 SceneManager.SetDebugPacketLevelOnCurrentScene(newDebug, name);
896 // We provide user information elsewhere if any clients had their debug level set. 896 // We provide user information elsewhere if any clients had their debug level set.
897// MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug); 897// MainConsole.Instance.OutputFormat("Debug packet level set to {0}", newDebug);
898 } 898 }
@@ -907,7 +907,7 @@ namespace OpenSim
907 case "scene": 907 case "scene":
908 if (args.Length == 4) 908 if (args.Length == 4)
909 { 909 {
910 if (m_sceneManager.CurrentScene == null) 910 if (SceneManager.CurrentScene == null)
911 { 911 {
912 MainConsole.Instance.Output("Please use 'change region <regioname>' first"); 912 MainConsole.Instance.Output("Please use 'change region <regioname>' first");
913 } 913 }
@@ -915,7 +915,7 @@ namespace OpenSim
915 { 915 {
916 string key = args[2]; 916 string key = args[2];
917 string value = args[3]; 917 string value = args[3];
918 m_sceneManager.CurrentScene.SetSceneCoreDebug( 918 SceneManager.CurrentScene.SetSceneCoreDebug(
919 new Dictionary<string, string>() { { key, value } }); 919 new Dictionary<string, string>() { { key, value } });
920 920
921 MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value); 921 MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value);
@@ -954,10 +954,10 @@ namespace OpenSim
954 IList agents; 954 IList agents;
955 if (showParams.Length > 1 && showParams[1] == "full") 955 if (showParams.Length > 1 && showParams[1] == "full")
956 { 956 {
957 agents = m_sceneManager.GetCurrentScenePresences(); 957 agents = SceneManager.GetCurrentScenePresences();
958 } else 958 } else
959 { 959 {
960 agents = m_sceneManager.GetCurrentSceneAvatars(); 960 agents = SceneManager.GetCurrentSceneAvatars();
961 } 961 }
962 962
963 MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count)); 963 MainConsole.Instance.Output(String.Format("\nAgents connected: {0}\n", agents.Count));
@@ -1037,7 +1037,7 @@ namespace OpenSim
1037 MainConsole.Instance.Output("Shared Module: " + module.Name); 1037 MainConsole.Instance.Output("Shared Module: " + module.Name);
1038 } 1038 }
1039 1039
1040 m_sceneManager.ForEachScene( 1040 SceneManager.ForEachScene(
1041 delegate(Scene scene) { 1041 delegate(Scene scene) {
1042 m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:"); 1042 m_log.Error("The currently loaded modules in " + scene.RegionInfo.RegionName + " are:");
1043 foreach (IRegionModule module in scene.Modules.Values) 1043 foreach (IRegionModule module in scene.Modules.Values)
@@ -1050,7 +1050,7 @@ namespace OpenSim
1050 } 1050 }
1051 ); 1051 );
1052 1052
1053 m_sceneManager.ForEachScene( 1053 SceneManager.ForEachScene(
1054 delegate(Scene scene) { 1054 delegate(Scene scene) {
1055 MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:"); 1055 MainConsole.Instance.Output("Loaded new region modules in" + scene.RegionInfo.RegionName + " are:");
1056 foreach (IRegionModuleBase module in scene.RegionModules.Values) 1056 foreach (IRegionModuleBase module in scene.RegionModules.Values)
@@ -1066,7 +1066,7 @@ namespace OpenSim
1066 break; 1066 break;
1067 1067
1068 case "regions": 1068 case "regions":
1069 m_sceneManager.ForEachScene( 1069 SceneManager.ForEachScene(
1070 delegate(Scene scene) 1070 delegate(Scene scene)
1071 { 1071 {
1072 MainConsole.Instance.Output(String.Format( 1072 MainConsole.Instance.Output(String.Format(
@@ -1080,7 +1080,7 @@ namespace OpenSim
1080 break; 1080 break;
1081 1081
1082 case "ratings": 1082 case "ratings":
1083 m_sceneManager.ForEachScene( 1083 SceneManager.ForEachScene(
1084 delegate(Scene scene) 1084 delegate(Scene scene)
1085 { 1085 {
1086 string rating = ""; 1086 string rating = "";
@@ -1115,7 +1115,7 @@ namespace OpenSim
1115 cdt.AddColumn("IP", 16); 1115 cdt.AddColumn("IP", 16);
1116 cdt.AddColumn("Viewer Name", 24); 1116 cdt.AddColumn("Viewer Name", 24);
1117 1117
1118 m_sceneManager.ForEachScene( 1118 SceneManager.ForEachScene(
1119 s => 1119 s =>
1120 { 1120 {
1121 foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values) 1121 foreach (AgentCircuitData aCircuit in s.AuthenticateHandler.GetAgentCircuits().Values)
@@ -1140,7 +1140,7 @@ namespace OpenSim
1140 cdt.AddColumn("Endpoint", 23); 1140 cdt.AddColumn("Endpoint", 23);
1141 cdt.AddColumn("Active?", 7); 1141 cdt.AddColumn("Active?", 7);
1142 1142
1143 m_sceneManager.ForEachScene( 1143 SceneManager.ForEachScene(
1144 s => s.ForEachClient( 1144 s => s.ForEachClient(
1145 c => cdt.AddRow( 1145 c => cdt.AddRow(
1146 s.Name, 1146 s.Name,
@@ -1161,11 +1161,11 @@ namespace OpenSim
1161 { 1161 {
1162 if (cmdparams.Length > 5) 1162 if (cmdparams.Length > 5)
1163 { 1163 {
1164 m_sceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]); 1164 SceneManager.SaveNamedPrimsToXml2(cmdparams[3], cmdparams[4]);
1165 } 1165 }
1166 else 1166 else
1167 { 1167 {
1168 m_sceneManager.SaveNamedPrimsToXml2("Primitive", DEFAULT_PRIM_BACKUP_FILENAME); 1168 SceneManager.SaveNamedPrimsToXml2("Primitive", DEFAULT_PRIM_BACKUP_FILENAME);
1169 } 1169 }
1170 } 1170 }
1171 1171
@@ -1180,11 +1180,11 @@ namespace OpenSim
1180 1180
1181 if (cmdparams.Length > 0) 1181 if (cmdparams.Length > 0)
1182 { 1182 {
1183 m_sceneManager.SaveCurrentSceneToXml(cmdparams[2]); 1183 SceneManager.SaveCurrentSceneToXml(cmdparams[2]);
1184 } 1184 }
1185 else 1185 else
1186 { 1186 {
1187 m_sceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME); 1187 SceneManager.SaveCurrentSceneToXml(DEFAULT_PRIM_BACKUP_FILENAME);
1188 } 1188 }
1189 } 1189 }
1190 1190
@@ -1221,13 +1221,13 @@ namespace OpenSim
1221 MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z)); 1221 MainConsole.Instance.Output(String.Format("loadOffsets <X,Y,Z> = <{0},{1},{2}>",loadOffset.X,loadOffset.Y,loadOffset.Z));
1222 } 1222 }
1223 } 1223 }
1224 m_sceneManager.LoadCurrentSceneFromXml(cmdparams[2], generateNewIDS, loadOffset); 1224 SceneManager.LoadCurrentSceneFromXml(cmdparams[2], generateNewIDS, loadOffset);
1225 } 1225 }
1226 else 1226 else
1227 { 1227 {
1228 try 1228 try
1229 { 1229 {
1230 m_sceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset); 1230 SceneManager.LoadCurrentSceneFromXml(DEFAULT_PRIM_BACKUP_FILENAME, false, loadOffset);
1231 } 1231 }
1232 catch (FileNotFoundException) 1232 catch (FileNotFoundException)
1233 { 1233 {
@@ -1244,11 +1244,11 @@ namespace OpenSim
1244 { 1244 {
1245 if (cmdparams.Length > 2) 1245 if (cmdparams.Length > 2)
1246 { 1246 {
1247 m_sceneManager.SaveCurrentSceneToXml2(cmdparams[2]); 1247 SceneManager.SaveCurrentSceneToXml2(cmdparams[2]);
1248 } 1248 }
1249 else 1249 else
1250 { 1250 {
1251 m_sceneManager.SaveCurrentSceneToXml2(DEFAULT_PRIM_BACKUP_FILENAME); 1251 SceneManager.SaveCurrentSceneToXml2(DEFAULT_PRIM_BACKUP_FILENAME);
1252 } 1252 }
1253 } 1253 }
1254 1254
@@ -1263,7 +1263,7 @@ namespace OpenSim
1263 { 1263 {
1264 try 1264 try
1265 { 1265 {
1266 m_sceneManager.LoadCurrentSceneFromXml2(cmdparams[2]); 1266 SceneManager.LoadCurrentSceneFromXml2(cmdparams[2]);
1267 } 1267 }
1268 catch (FileNotFoundException) 1268 catch (FileNotFoundException)
1269 { 1269 {
@@ -1274,7 +1274,7 @@ namespace OpenSim
1274 { 1274 {
1275 try 1275 try
1276 { 1276 {
1277 m_sceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME); 1277 SceneManager.LoadCurrentSceneFromXml2(DEFAULT_PRIM_BACKUP_FILENAME);
1278 } 1278 }
1279 catch (FileNotFoundException) 1279 catch (FileNotFoundException)
1280 { 1280 {
@@ -1291,7 +1291,7 @@ namespace OpenSim
1291 { 1291 {
1292 try 1292 try
1293 { 1293 {
1294 m_sceneManager.LoadArchiveToCurrentScene(cmdparams); 1294 SceneManager.LoadArchiveToCurrentScene(cmdparams);
1295 } 1295 }
1296 catch (Exception e) 1296 catch (Exception e)
1297 { 1297 {
@@ -1305,7 +1305,7 @@ namespace OpenSim
1305 /// <param name="cmdparams"></param> 1305 /// <param name="cmdparams"></param>
1306 protected void SaveOar(string module, string[] cmdparams) 1306 protected void SaveOar(string module, string[] cmdparams)
1307 { 1307 {
1308 m_sceneManager.SaveCurrentSceneToArchive(cmdparams); 1308 SceneManager.SaveCurrentSceneToArchive(cmdparams);
1309 } 1309 }
1310 1310
1311 private static string CombineParams(string[] commandParams, int pos) 1311 private static string CombineParams(string[] commandParams, int pos)