diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/GcNotify.cs | 62 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 34 | ||||
-rw-r--r-- | OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | 8 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 97 | ||||
-rw-r--r-- | OpenSim/Region/Framework/Scenes/ScenePresence.cs | 2 |
5 files changed, 143 insertions, 60 deletions
diff --git a/OpenSim/Framework/GcNotify.cs b/OpenSim/Framework/GcNotify.cs new file mode 100644 index 0000000..14a22a6 --- /dev/null +++ b/OpenSim/Framework/GcNotify.cs | |||
@@ -0,0 +1,62 @@ | |||
1 | /* | ||
2 | * Copyright (c) Contributors, http://opensimulator.org/ | ||
3 | * See CONTRIBUTORS.TXT for a full list of copyright holders. | ||
4 | * | ||
5 | * Redistribution and use in source and binary forms, with or without | ||
6 | * modification, are permitted provided that the following conditions are met: | ||
7 | * * Redistributions of source code must retain the above copyright | ||
8 | * notice, this list of conditions and the following disclaimer. | ||
9 | * * Redistributions in binary form must reproduce the above copyright | ||
10 | * notice, this list of conditions and the following disclaimer in the | ||
11 | * documentation and/or other materials provided with the distribution. | ||
12 | * * Neither the name of the OpenSimulator Project nor the | ||
13 | * names of its contributors may be used to endorse or promote products | ||
14 | * derived from this software without specific prior written permission. | ||
15 | * | ||
16 | * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY | ||
17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
19 | * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY | ||
20 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | ||
23 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
26 | */ | ||
27 | |||
28 | using System; | ||
29 | using System.Reflection; | ||
30 | using log4net; | ||
31 | |||
32 | public class GcNotify | ||
33 | { | ||
34 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
35 | |||
36 | public static bool Enabled | ||
37 | { | ||
38 | get { return s_initialized; } | ||
39 | set | ||
40 | { | ||
41 | if (!s_initialized && value) | ||
42 | new GcNotify(); | ||
43 | |||
44 | s_initialized = value; | ||
45 | } | ||
46 | } | ||
47 | |||
48 | private static bool s_initialized = false; | ||
49 | |||
50 | private GcNotify() {} | ||
51 | |||
52 | ~GcNotify() | ||
53 | { | ||
54 | if (!Environment.HasShutdownStarted && !AppDomain.CurrentDomain.IsFinalizingForUnload()) | ||
55 | { | ||
56 | m_log.DebugFormat("[GC NOTIFY]: Garbage collection triggered."); | ||
57 | |||
58 | if (Enabled) | ||
59 | new GcNotify(); | ||
60 | } | ||
61 | } | ||
62 | } \ No newline at end of file | ||
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index e955a58..59b6b21 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -919,7 +919,7 @@ namespace OpenSim | |||
919 | break; | 919 | break; |
920 | 920 | ||
921 | case "scene": | 921 | case "scene": |
922 | if (args.Length == 5) | 922 | if (args.Length == 4) |
923 | { | 923 | { |
924 | if (m_sceneManager.CurrentScene == null) | 924 | if (m_sceneManager.CurrentScene == null) |
925 | { | 925 | { |
@@ -927,39 +927,21 @@ namespace OpenSim | |||
927 | } | 927 | } |
928 | else | 928 | else |
929 | { | 929 | { |
930 | bool scriptingOn = !Convert.ToBoolean(args[2]); | 930 | string key = args[2]; |
931 | bool collisionsOn = !Convert.ToBoolean(args[3]); | 931 | string value = args[3]; |
932 | bool physicsOn = !Convert.ToBoolean(args[4]); | 932 | m_sceneManager.CurrentScene.SetSceneCoreDebug( |
933 | m_sceneManager.CurrentScene.SetSceneCoreDebug(scriptingOn, collisionsOn, physicsOn); | 933 | new Dictionary<string, string>() { { key, value } }); |
934 | 934 | ||
935 | MainConsole.Instance.Output( | 935 | MainConsole.Instance.OutputFormat("Set debug scene {0} = {1}", key, value); |
936 | String.Format( | ||
937 | "Set debug scene scripting = {0}, collisions = {1}, physics = {2}", | ||
938 | !scriptingOn, !collisionsOn, !physicsOn)); | ||
939 | } | 936 | } |
940 | } | 937 | } |
941 | else | 938 | else |
942 | { | 939 | { |
943 | MainConsole.Instance.Output("Usage: debug scene <scripting> <collisions> <physics> (where inside <> is true/false)"); | 940 | MainConsole.Instance.Output("Usage: debug scene scripting|collisions|physics|teleport true|false"); |
944 | } | 941 | } |
945 | 942 | ||
946 | break; | 943 | break; |
947 | 944 | ||
948 | case "teleport": | ||
949 | foreach(Scene s in m_sceneManager.Scenes) | ||
950 | { | ||
951 | if (s.DEBUG) | ||
952 | { | ||
953 | s.DEBUG = false; | ||
954 | MainConsole.Instance.Output("Teleport debugging is disabled!"); | ||
955 | } | ||
956 | else{ | ||
957 | s.DEBUG = true; | ||
958 | MainConsole.Instance.Output("Teleport debugging is enabled!"); | ||
959 | } | ||
960 | } | ||
961 | break; | ||
962 | |||
963 | default: | 945 | default: |
964 | MainConsole.Instance.Output("Unknown debug command"); | 946 | MainConsole.Instance.Output("Unknown debug command"); |
965 | break; | 947 | break; |
diff --git a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs index 1adeb88..fc217b0 100644 --- a/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs | |||
@@ -670,7 +670,13 @@ namespace OpenSim.Region.CoreModules.World.Estate | |||
670 | Scene.RegionInfo.RegionSettings.Save(); | 670 | Scene.RegionInfo.RegionSettings.Save(); |
671 | TriggerRegionInfoChange(); | 671 | TriggerRegionInfoChange(); |
672 | 672 | ||
673 | Scene.SetSceneCoreDebug(disableScripts, disableCollisions, disablePhysics); | 673 | Scene.SetSceneCoreDebug( |
674 | new Dictionary<string, string>() { | ||
675 | { "scripting", (!disableScripts).ToString() }, | ||
676 | { "collisions", (!disableCollisions).ToString() }, | ||
677 | { "physics", (!disablePhysics).ToString() } | ||
678 | } | ||
679 | ); | ||
674 | } | 680 | } |
675 | 681 | ||
676 | private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) | 682 | private void handleEstateTeleportOneUserHomeRequest(IClientAPI remover_client, UUID invoice, UUID senderID, UUID prey) |
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 790ec63..76e632e 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -65,7 +65,16 @@ namespace OpenSim.Region.Framework.Scenes | |||
65 | #region Fields | 65 | #region Fields |
66 | 66 | ||
67 | public bool EmergencyMonitoring = false; | 67 | public bool EmergencyMonitoring = false; |
68 | public bool DEBUG = false; | 68 | |
69 | /// <summary> | ||
70 | /// Show debug information about teleports. | ||
71 | /// </summary> | ||
72 | public bool DebugTeleporting { get; private set; } | ||
73 | |||
74 | /// <summary> | ||
75 | /// Show debug information about the scene loop. | ||
76 | /// </summary> | ||
77 | public bool DebugUpdates { get; private set; } | ||
69 | 78 | ||
70 | public SynchronizeSceneHandler SynchronizeScene; | 79 | public SynchronizeSceneHandler SynchronizeScene; |
71 | public SimStatsReporter StatsReporter; | 80 | public SimStatsReporter StatsReporter; |
@@ -1020,44 +1029,66 @@ namespace OpenSim.Region.Framework.Scenes | |||
1020 | } | 1029 | } |
1021 | } | 1030 | } |
1022 | 1031 | ||
1023 | public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) | 1032 | public void SetSceneCoreDebug(Dictionary<string, string> options) |
1024 | { | 1033 | { |
1025 | if (m_scripts_enabled != !ScriptEngine) | 1034 | if (options.ContainsKey("scripting")) |
1026 | { | 1035 | { |
1027 | if (ScriptEngine) | 1036 | bool enableScripts = true; |
1037 | if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts) | ||
1028 | { | 1038 | { |
1029 | m_log.Info("Stopping all Scripts in Scene"); | 1039 | if (!enableScripts) |
1030 | |||
1031 | EntityBase[] entities = Entities.GetEntities(); | ||
1032 | foreach (EntityBase ent in entities) | ||
1033 | { | 1040 | { |
1034 | if (ent is SceneObjectGroup) | 1041 | m_log.Info("Stopping all Scripts in Scene"); |
1035 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | 1042 | |
1043 | EntityBase[] entities = Entities.GetEntities(); | ||
1044 | foreach (EntityBase ent in entities) | ||
1045 | { | ||
1046 | if (ent is SceneObjectGroup) | ||
1047 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | ||
1048 | } | ||
1036 | } | 1049 | } |
1037 | } | 1050 | else |
1038 | else | ||
1039 | { | ||
1040 | m_log.Info("Starting all Scripts in Scene"); | ||
1041 | |||
1042 | EntityBase[] entities = Entities.GetEntities(); | ||
1043 | foreach (EntityBase ent in entities) | ||
1044 | { | 1051 | { |
1045 | if (ent is SceneObjectGroup) | 1052 | m_log.Info("Starting all Scripts in Scene"); |
1053 | |||
1054 | EntityBase[] entities = Entities.GetEntities(); | ||
1055 | foreach (EntityBase ent in entities) | ||
1046 | { | 1056 | { |
1047 | SceneObjectGroup sog = (SceneObjectGroup)ent; | 1057 | if (ent is SceneObjectGroup) |
1048 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 1058 | { |
1049 | sog.ResumeScripts(); | 1059 | SceneObjectGroup sog = (SceneObjectGroup)ent; |
1060 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); | ||
1061 | sog.ResumeScripts(); | ||
1062 | } | ||
1050 | } | 1063 | } |
1051 | } | 1064 | } |
1065 | |||
1066 | m_scripts_enabled = enableScripts; | ||
1052 | } | 1067 | } |
1068 | } | ||
1053 | 1069 | ||
1054 | m_scripts_enabled = !ScriptEngine; | 1070 | if (options.ContainsKey("physics")) |
1055 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); | 1071 | { |
1072 | bool enablePhysics; | ||
1073 | if (bool.TryParse(options["physics"], out enablePhysics)) | ||
1074 | m_physics_enabled = enablePhysics; | ||
1075 | } | ||
1076 | |||
1077 | if (options.ContainsKey("teleport")) | ||
1078 | { | ||
1079 | bool enableTeleportDebugging; | ||
1080 | if (bool.TryParse(options["teleport"], out enableTeleportDebugging)) | ||
1081 | DebugTeleporting = enableTeleportDebugging; | ||
1056 | } | 1082 | } |
1057 | 1083 | ||
1058 | if (m_physics_enabled != !PhysicsEngine) | 1084 | if (options.ContainsKey("updates")) |
1059 | { | 1085 | { |
1060 | m_physics_enabled = !PhysicsEngine; | 1086 | bool enableUpdateDebugging; |
1087 | if (bool.TryParse(options["updates"], out enableUpdateDebugging)) | ||
1088 | { | ||
1089 | DebugUpdates = enableUpdateDebugging; | ||
1090 | GcNotify.Enabled = DebugUpdates; | ||
1091 | } | ||
1061 | } | 1092 | } |
1062 | } | 1093 | } |
1063 | 1094 | ||
@@ -1382,7 +1413,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1382 | // Tell the watchdog that this thread is still alive | 1413 | // Tell the watchdog that this thread is still alive |
1383 | Watchdog.UpdateThread(); | 1414 | Watchdog.UpdateThread(); |
1384 | 1415 | ||
1385 | // previousFrameTick = m_lastFrameTick; | 1416 | previousFrameTick = m_lastFrameTick; |
1386 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1417 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1387 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1418 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); |
1388 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1419 | maintc = (int)(MinFrameTime * 1000) - maintc; |
@@ -1391,12 +1422,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1391 | Thread.Sleep(maintc); | 1422 | Thread.Sleep(maintc); |
1392 | 1423 | ||
1393 | // Optionally warn if a frame takes double the amount of time that it should. | 1424 | // Optionally warn if a frame takes double the amount of time that it should. |
1394 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) | 1425 | if (DebugUpdates |
1395 | // m_log.WarnFormat( | 1426 | && Util.EnvironmentTickCountSubtract( |
1396 | // "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", | 1427 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) |
1397 | // Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), | 1428 | m_log.WarnFormat( |
1398 | // MinFrameTime * 1000, | 1429 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", |
1399 | // RegionInfo.RegionName); | 1430 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), |
1431 | MinFrameTime * 1000, | ||
1432 | RegionInfo.RegionName); | ||
1400 | } | 1433 | } |
1401 | } | 1434 | } |
1402 | 1435 | ||
diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 704d12d..cf60c69 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs | |||
@@ -3826,7 +3826,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
3826 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); | 3826 | ILandObject land = m_scene.LandChannel.GetLandObject(pos.X, pos.Y); |
3827 | if (land != null) | 3827 | if (land != null) |
3828 | { | 3828 | { |
3829 | if (Scene.DEBUG) | 3829 | if (Scene.DebugTeleporting) |
3830 | TeleportFlagsDebug(); | 3830 | TeleportFlagsDebug(); |
3831 | 3831 | ||
3832 | // If we come in via login, landmark or map, we want to | 3832 | // If we come in via login, landmark or map, we want to |