aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
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
parentMake SceneManager.OnRegionsReadyStatusChange event available. (diff)
downloadopensim-SC_OLD-a1e99642c19810f98084e77723df1e242d2c26d0.zip
opensim-SC_OLD-a1e99642c19810f98084e77723df1e242d2c26d0.tar.gz
opensim-SC_OLD-a1e99642c19810f98084e77723df1e242d2c26d0.tar.bz2
opensim-SC_OLD-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 'OpenSim')
-rw-r--r--OpenSim/Framework/Statistics/BaseStatsCollector.cs20
-rw-r--r--OpenSim/Framework/Watchdog.cs3
-rw-r--r--OpenSim/Region/Application/OpenSim.cs72
-rw-r--r--OpenSim/Region/Application/OpenSimBase.cs36
-rw-r--r--OpenSim/Region/ClientStack/RegionApplicationBase.cs4
5 files changed, 72 insertions, 63 deletions
diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs
index c9e57ce..28ce650 100644
--- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs
@@ -44,14 +44,18 @@ namespace OpenSim.Framework.Statistics
44 StringBuilder sb = new StringBuilder(Environment.NewLine); 44 StringBuilder sb = new StringBuilder(Environment.NewLine);
45 sb.Append("MEMORY STATISTICS"); 45 sb.Append("MEMORY STATISTICS");
46 sb.Append(Environment.NewLine); 46 sb.Append(Environment.NewLine);
47 sb.Append( 47
48 string.Format( 48 sb.AppendFormat(
49 "Allocated to OpenSim objects: {0} MB\n", 49 "Allocated to OpenSim objects: {0} MB\n",
50 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); 50 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0));
51 sb.Append( 51
52 string.Format( 52 sb.AppendFormat(
53 "Process memory : {0} MB\n", 53 "OpenSim object memory churn : {0} KB/s\n",
54 Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0))); 54 Math.Round((MemoryWatchdog.AverageMemoryChurn * 1000) / 1024.0 / 1024, 3));
55
56 sb.AppendFormat(
57 "Process memory : {0} MB\n",
58 Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0));
55 59
56 return sb.ToString(); 60 return sb.ToString();
57 } 61 }
diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs
index 8a74f53..54e3d1a 100644
--- a/OpenSim/Framework/Watchdog.cs
+++ b/OpenSim/Framework/Watchdog.cs
@@ -325,6 +325,9 @@ namespace OpenSim.Framework
325 callback(callbackInfo); 325 callback(callbackInfo);
326 } 326 }
327 327
328 if (MemoryWatchdog.Enabled)
329 MemoryWatchdog.Update();
330
328 m_watchdogTimer.Start(); 331 m_watchdogTimer.Start();
329 } 332 }
330 } 333 }
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)
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
285 285
286 private void HandleCommanderCommand(string module, string[] cmd) 286 private void HandleCommanderCommand(string module, string[] cmd)
287 { 287 {
288 m_sceneManager.SendCommandToPluginModules(cmd); 288 SceneManager.SendCommandToPluginModules(cmd);
289 } 289 }
290 290
291 private void HandleCommanderHelp(string module, string[] cmd) 291 private void HandleCommanderHelp(string module, string[] cmd)
@@ -303,7 +303,10 @@ namespace OpenSim
303 // Called from base.StartUp() 303 // Called from base.StartUp()
304 304
305 m_httpServerPort = m_networkServersInfo.HttpListenerPort; 305 m_httpServerPort = m_networkServersInfo.HttpListenerPort;
306 m_sceneManager.OnRestartSim += handleRestartRegion; 306 SceneManager.OnRestartSim += handleRestartRegion;
307
308 // Only start the memory watchdog once all regions are ready
309 SceneManager.OnRegionsReadyStatusChange += sm => MemoryWatchdog.Enabled = sm.AllRegionsReady;
307 } 310 }
308 311
309 /// <summary> 312 /// <summary>
@@ -412,7 +415,7 @@ namespace OpenSim
412 // scripting engines. 415 // scripting engines.
413 scene.CreateScriptInstances(); 416 scene.CreateScriptInstances();
414 417
415 m_sceneManager.Add(scene); 418 SceneManager.Add(scene);
416 419
417 if (m_autoCreateClientStack) 420 if (m_autoCreateClientStack)
418 { 421 {
@@ -432,7 +435,6 @@ namespace OpenSim
432 mscene = scene; 435 mscene = scene;
433 436
434 scene.Start(); 437 scene.Start();
435
436 scene.StartScripts(); 438 scene.StartScripts();
437 439
438 return clientServer; 440 return clientServer;
@@ -561,14 +563,14 @@ namespace OpenSim
561 { 563 {
562 // only need to check this if we are not at the 564 // only need to check this if we are not at the
563 // root level 565 // root level
564 if ((m_sceneManager.CurrentScene != null) && 566 if ((SceneManager.CurrentScene != null) &&
565 (m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) 567 (SceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
566 { 568 {
567 m_sceneManager.TrySetCurrentScene(".."); 569 SceneManager.TrySetCurrentScene("..");
568 } 570 }
569 571
570 scene.DeleteAllSceneObjects(); 572 scene.DeleteAllSceneObjects();
571 m_sceneManager.CloseScene(scene); 573 SceneManager.CloseScene(scene);
572 ShutdownClientServer(scene.RegionInfo); 574 ShutdownClientServer(scene.RegionInfo);
573 575
574 if (!cleanup) 576 if (!cleanup)
@@ -610,7 +612,7 @@ namespace OpenSim
610 public void RemoveRegion(string name, bool cleanUp) 612 public void RemoveRegion(string name, bool cleanUp)
611 { 613 {
612 Scene target; 614 Scene target;
613 if (m_sceneManager.TryGetScene(name, out target)) 615 if (SceneManager.TryGetScene(name, out target))
614 RemoveRegion(target, cleanUp); 616 RemoveRegion(target, cleanUp);
615 } 617 }
616 618
@@ -623,13 +625,13 @@ namespace OpenSim
623 { 625 {
624 // only need to check this if we are not at the 626 // only need to check this if we are not at the
625 // root level 627 // root level
626 if ((m_sceneManager.CurrentScene != null) && 628 if ((SceneManager.CurrentScene != null) &&
627 (m_sceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID)) 629 (SceneManager.CurrentScene.RegionInfo.RegionID == scene.RegionInfo.RegionID))
628 { 630 {
629 m_sceneManager.TrySetCurrentScene(".."); 631 SceneManager.TrySetCurrentScene("..");
630 } 632 }
631 633
632 m_sceneManager.CloseScene(scene); 634 SceneManager.CloseScene(scene);
633 ShutdownClientServer(scene.RegionInfo); 635 ShutdownClientServer(scene.RegionInfo);
634 } 636 }
635 637
@@ -641,7 +643,7 @@ namespace OpenSim
641 public void CloseRegion(string name) 643 public void CloseRegion(string name)
642 { 644 {
643 Scene target; 645 Scene target;
644 if (m_sceneManager.TryGetScene(name, out target)) 646 if (SceneManager.TryGetScene(name, out target))
645 CloseRegion(target); 647 CloseRegion(target);
646 } 648 }
647 649
@@ -897,7 +899,7 @@ namespace OpenSim
897 899
898 try 900 try
899 { 901 {
900 m_sceneManager.Close(); 902 SceneManager.Close();
901 } 903 }
902 catch (Exception e) 904 catch (Exception e)
903 { 905 {
@@ -922,7 +924,7 @@ namespace OpenSim
922 /// <param name="usernum">The first out parameter describing the number of all the avatars in the Region server</param> 924 /// <param name="usernum">The first out parameter describing the number of all the avatars in the Region server</param>
923 public void GetAvatarNumber(out int usernum) 925 public void GetAvatarNumber(out int usernum)
924 { 926 {
925 usernum = m_sceneManager.GetCurrentSceneAvatars().Count; 927 usernum = SceneManager.GetCurrentSceneAvatars().Count;
926 } 928 }
927 929
928 /// <summary> 930 /// <summary>
@@ -931,7 +933,7 @@ namespace OpenSim
931 /// <param name="regionnum">The first out parameter describing the number of regions</param> 933 /// <param name="regionnum">The first out parameter describing the number of regions</param>
932 public void GetRegionNumber(out int regionnum) 934 public void GetRegionNumber(out int regionnum)
933 { 935 {
934 regionnum = m_sceneManager.Scenes.Count; 936 regionnum = SceneManager.Scenes.Count;
935 } 937 }
936 938
937 /// <summary> 939 /// <summary>
diff --git a/OpenSim/Region/ClientStack/RegionApplicationBase.cs b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
index c4324e8..4672f8a 100644
--- a/OpenSim/Region/ClientStack/RegionApplicationBase.cs
+++ b/OpenSim/Region/ClientStack/RegionApplicationBase.cs
@@ -53,9 +53,8 @@ namespace OpenSim.Region.ClientStack
53 protected ISimulationDataService m_simulationDataService; 53 protected ISimulationDataService m_simulationDataService;
54 protected IEstateDataService m_estateDataService; 54 protected IEstateDataService m_estateDataService;
55 protected ClientStackManager m_clientStackManager; 55 protected ClientStackManager m_clientStackManager;
56 protected SceneManager m_sceneManager = new SceneManager();
57 56
58 public SceneManager SceneManager { get { return m_sceneManager; } } 57 public SceneManager SceneManager { get; protected set; }
59 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } } 58 public NetworkServersInfo NetServersInfo { get { return m_networkServersInfo; } }
60 public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } } 59 public ISimulationDataService SimulationDataService { get { return m_simulationDataService; } }
61 public IEstateDataService EstateDataService { get { return m_estateDataService; } } 60 public IEstateDataService EstateDataService { get { return m_estateDataService; } }
@@ -77,6 +76,7 @@ namespace OpenSim.Region.ClientStack
77 76
78 protected override void StartupSpecific() 77 protected override void StartupSpecific()
79 { 78 {
79 SceneManager = new SceneManager();
80 m_clientStackManager = CreateClientStackManager(); 80 m_clientStackManager = CreateClientStackManager();
81 81
82 Initialize(); 82 Initialize();