diff options
Diffstat (limited to 'OpenSim/Region/Framework/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Framework/Scenes/Scene.cs | 97 |
1 files changed, 65 insertions, 32 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index 44ee453..44a738e 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; |
@@ -1053,44 +1062,66 @@ namespace OpenSim.Region.Framework.Scenes | |||
1053 | } | 1062 | } |
1054 | } | 1063 | } |
1055 | 1064 | ||
1056 | public void SetSceneCoreDebug(bool ScriptEngine, bool CollisionEvents, bool PhysicsEngine) | 1065 | public void SetSceneCoreDebug(Dictionary<string, string> options) |
1057 | { | 1066 | { |
1058 | if (m_scripts_enabled != !ScriptEngine) | 1067 | if (options.ContainsKey("scripting")) |
1059 | { | 1068 | { |
1060 | if (ScriptEngine) | 1069 | bool enableScripts = true; |
1070 | if (bool.TryParse(options["scripting"], out enableScripts) && m_scripts_enabled != enableScripts) | ||
1061 | { | 1071 | { |
1062 | m_log.Info("Stopping all Scripts in Scene"); | 1072 | if (!enableScripts) |
1063 | |||
1064 | EntityBase[] entities = Entities.GetEntities(); | ||
1065 | foreach (EntityBase ent in entities) | ||
1066 | { | 1073 | { |
1067 | if (ent is SceneObjectGroup) | 1074 | m_log.Info("Stopping all Scripts in Scene"); |
1068 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | 1075 | |
1076 | EntityBase[] entities = Entities.GetEntities(); | ||
1077 | foreach (EntityBase ent in entities) | ||
1078 | { | ||
1079 | if (ent is SceneObjectGroup) | ||
1080 | ((SceneObjectGroup)ent).RemoveScriptInstances(false); | ||
1081 | } | ||
1069 | } | 1082 | } |
1070 | } | 1083 | else |
1071 | else | ||
1072 | { | ||
1073 | m_log.Info("Starting all Scripts in Scene"); | ||
1074 | |||
1075 | EntityBase[] entities = Entities.GetEntities(); | ||
1076 | foreach (EntityBase ent in entities) | ||
1077 | { | 1084 | { |
1078 | if (ent is SceneObjectGroup) | 1085 | m_log.Info("Starting all Scripts in Scene"); |
1086 | |||
1087 | EntityBase[] entities = Entities.GetEntities(); | ||
1088 | foreach (EntityBase ent in entities) | ||
1079 | { | 1089 | { |
1080 | SceneObjectGroup sog = (SceneObjectGroup)ent; | 1090 | if (ent is SceneObjectGroup) |
1081 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); | 1091 | { |
1082 | sog.ResumeScripts(); | 1092 | SceneObjectGroup sog = (SceneObjectGroup)ent; |
1093 | sog.CreateScriptInstances(0, false, DefaultScriptEngine, 0); | ||
1094 | sog.ResumeScripts(); | ||
1095 | } | ||
1083 | } | 1096 | } |
1084 | } | 1097 | } |
1098 | |||
1099 | m_scripts_enabled = enableScripts; | ||
1085 | } | 1100 | } |
1101 | } | ||
1086 | 1102 | ||
1087 | m_scripts_enabled = !ScriptEngine; | 1103 | if (options.ContainsKey("physics")) |
1088 | m_log.Info("[TOTEDD]: Here is the method to trigger disabling of the scripting engine"); | 1104 | { |
1105 | bool enablePhysics; | ||
1106 | if (bool.TryParse(options["physics"], out enablePhysics)) | ||
1107 | m_physics_enabled = enablePhysics; | ||
1108 | } | ||
1109 | |||
1110 | if (options.ContainsKey("teleport")) | ||
1111 | { | ||
1112 | bool enableTeleportDebugging; | ||
1113 | if (bool.TryParse(options["teleport"], out enableTeleportDebugging)) | ||
1114 | DebugTeleporting = enableTeleportDebugging; | ||
1089 | } | 1115 | } |
1090 | 1116 | ||
1091 | if (m_physics_enabled != !PhysicsEngine) | 1117 | if (options.ContainsKey("updates")) |
1092 | { | 1118 | { |
1093 | m_physics_enabled = !PhysicsEngine; | 1119 | bool enableUpdateDebugging; |
1120 | if (bool.TryParse(options["updates"], out enableUpdateDebugging)) | ||
1121 | { | ||
1122 | DebugUpdates = enableUpdateDebugging; | ||
1123 | GcNotify.Enabled = DebugUpdates; | ||
1124 | } | ||
1094 | } | 1125 | } |
1095 | } | 1126 | } |
1096 | 1127 | ||
@@ -1427,7 +1458,7 @@ namespace OpenSim.Region.Framework.Scenes | |||
1427 | // Tell the watchdog that this thread is still alive | 1458 | // Tell the watchdog that this thread is still alive |
1428 | Watchdog.UpdateThread(); | 1459 | Watchdog.UpdateThread(); |
1429 | 1460 | ||
1430 | // previousFrameTick = m_lastFrameTick; | 1461 | previousFrameTick = m_lastFrameTick; |
1431 | m_lastFrameTick = Util.EnvironmentTickCount(); | 1462 | m_lastFrameTick = Util.EnvironmentTickCount(); |
1432 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); | 1463 | maintc = Util.EnvironmentTickCountSubtract(m_lastFrameTick, maintc); |
1433 | maintc = (int)(MinFrameTime * 1000) - maintc; | 1464 | maintc = (int)(MinFrameTime * 1000) - maintc; |
@@ -1442,12 +1473,14 @@ namespace OpenSim.Region.Framework.Scenes | |||
1442 | m_firstHeartbeat = false; | 1473 | m_firstHeartbeat = false; |
1443 | 1474 | ||
1444 | // Optionally warn if a frame takes double the amount of time that it should. | 1475 | // Optionally warn if a frame takes double the amount of time that it should. |
1445 | // if (Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) | 1476 | if (DebugUpdates |
1446 | // m_log.WarnFormat( | 1477 | && Util.EnvironmentTickCountSubtract( |
1447 | // "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", | 1478 | m_lastFrameTick, previousFrameTick) > (int)(MinFrameTime * 1000 * 2)) |
1448 | // Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), | 1479 | m_log.WarnFormat( |
1449 | // MinFrameTime * 1000, | 1480 | "[SCENE]: Frame took {0} ms (desired max {1} ms) in {2}", |
1450 | // RegionInfo.RegionName); | 1481 | Util.EnvironmentTickCountSubtract(m_lastFrameTick, previousFrameTick), |
1482 | MinFrameTime * 1000, | ||
1483 | RegionInfo.RegionName); | ||
1451 | } | 1484 | } |
1452 | } | 1485 | } |
1453 | 1486 | ||