diff options
author | Justin Clark-Casey (justincc) | 2012-06-20 00:10:19 +0100 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-06-20 00:10:19 +0100 |
commit | 0fa303b1cf244b3066395413e640318b2122c19f (patch) | |
tree | 2288cbbe86aab9fe6c7460229b23f09afb59a91d /OpenSim/Region/ScriptEngine | |
parent | If RegionReady is active, don't falsely say that logins are enabled in the ma... (diff) | |
download | opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.zip opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.tar.gz opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.tar.bz2 opensim-SC_OLD-0fa303b1cf244b3066395413e640318b2122c19f.tar.xz |
Log how many scripts are candidates for starting and how many are actually started.
Adds DebugLevel infrastructure to XEngine though currently commented out and unused.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 64 |
1 files changed, 60 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index aedf2c1..3f623de 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -62,6 +62,14 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
62 | { | 62 | { |
63 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | 63 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); |
64 | 64 | ||
65 | /// <summary> | ||
66 | /// Control the printing of certain debug messages. | ||
67 | /// </summary> | ||
68 | /// <remarks> | ||
69 | /// If DebugLevel >= 1, then we log every time that a script is started. | ||
70 | /// </remarks> | ||
71 | // public int DebugLevel { get; set; } | ||
72 | |||
65 | private SmartThreadPool m_ThreadPool; | 73 | private SmartThreadPool m_ThreadPool; |
66 | private int m_MaxScriptQueue; | 74 | private int m_MaxScriptQueue; |
67 | private Scene m_Scene; | 75 | private Scene m_Scene; |
@@ -216,9 +224,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
216 | AppDomain.CurrentDomain.AssemblyResolve += | 224 | AppDomain.CurrentDomain.AssemblyResolve += |
217 | OnAssemblyResolve; | 225 | OnAssemblyResolve; |
218 | 226 | ||
219 | m_log.InfoFormat("[XEngine] Initializing scripts in region {0}", | ||
220 | scene.RegionInfo.RegionName); | ||
221 | m_Scene = scene; | 227 | m_Scene = scene; |
228 | m_log.InfoFormat("[XEngine]: Initializing scripts in region {0}", m_Scene.RegionInfo.RegionName); | ||
222 | 229 | ||
223 | m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2); | 230 | m_MinThreads = m_ScriptConfig.GetInt("MinThreads", 2); |
224 | m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100); | 231 | m_MaxThreads = m_ScriptConfig.GetInt("MaxThreads", 100); |
@@ -321,9 +328,42 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
321 | "Starts all stopped scripts." | 328 | "Starts all stopped scripts." |
322 | + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", | 329 | + "If a <script-item-uuid> is given then only that script will be started. Otherwise, all suitable scripts are started.", |
323 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); | 330 | (module, cmdparams) => HandleScriptsAction(cmdparams, HandleStartScript)); |
331 | |||
332 | // MainConsole.Instance.Commands.AddCommand( | ||
333 | // "Debug", false, "debug xengine", "debug xengine [<level>]", | ||
334 | // "Turn on detailed xengine debugging.", | ||
335 | // "If level <= 0, then no extra logging is done.\n" | ||
336 | // + "If level >= 1, then we log every time that a script is started.", | ||
337 | // HandleDebugLevelCommand); | ||
324 | } | 338 | } |
325 | 339 | ||
326 | /// <summary> | 340 | /// <summary> |
341 | /// Change debug level | ||
342 | /// </summary> | ||
343 | /// <param name="module"></param> | ||
344 | /// <param name="args"></param> | ||
345 | // private void HandleDebugLevelCommand(string module, string[] args) | ||
346 | // { | ||
347 | // if (args.Length == 3) | ||
348 | // { | ||
349 | // int newDebug; | ||
350 | // if (int.TryParse(args[2], out newDebug)) | ||
351 | // { | ||
352 | // DebugLevel = newDebug; | ||
353 | // MainConsole.Instance.OutputFormat("Debug level set to {0}", newDebug); | ||
354 | // } | ||
355 | // } | ||
356 | // else if (args.Length == 2) | ||
357 | // { | ||
358 | // MainConsole.Instance.OutputFormat("Current debug level is {0}", DebugLevel); | ||
359 | // } | ||
360 | // else | ||
361 | // { | ||
362 | // MainConsole.Instance.Output("Usage: debug xengine 0..1"); | ||
363 | // } | ||
364 | // } | ||
365 | |||
366 | /// <summary> | ||
327 | /// Parse the raw item id into a script instance from the command params if it's present. | 367 | /// Parse the raw item id into a script instance from the command params if it's present. |
328 | /// </summary> | 368 | /// </summary> |
329 | /// <param name="cmdparams"></param> | 369 | /// <param name="cmdparams"></param> |
@@ -825,8 +865,23 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
825 | } | 865 | } |
826 | 866 | ||
827 | object[] o; | 867 | object[] o; |
868 | |||
869 | int scriptsStarted = 0; | ||
870 | |||
828 | while (m_CompileQueue.Dequeue(out o)) | 871 | while (m_CompileQueue.Dequeue(out o)) |
829 | DoOnRezScript(o); | 872 | { |
873 | if (DoOnRezScript(o)) | ||
874 | { | ||
875 | scriptsStarted++; | ||
876 | |||
877 | // if (scriptsStarted % 50 == 0) | ||
878 | // m_log.DebugFormat( | ||
879 | // "[XEngine]: Started {0} scripts in {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); | ||
880 | } | ||
881 | } | ||
882 | |||
883 | m_log.DebugFormat( | ||
884 | "[XEngine]: Completed starting {0} scripts on {1}", scriptsStarted, m_Scene.RegionInfo.RegionName); | ||
830 | 885 | ||
831 | // NOTE: Despite having a lockless queue, this lock is required | 886 | // NOTE: Despite having a lockless queue, this lock is required |
832 | // to make sure there is never no compile thread while there | 887 | // to make sure there is never no compile thread while there |
@@ -1066,7 +1121,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1066 | part.ParentGroup.RootPart.Name, | 1121 | part.ParentGroup.RootPart.Name, |
1067 | item.Name, startParam, postOnRez, | 1122 | item.Name, startParam, postOnRez, |
1068 | stateSource, m_MaxScriptQueue); | 1123 | stateSource, m_MaxScriptQueue); |
1069 | 1124 | ||
1125 | // if (DebugLevel >= 1) | ||
1070 | m_log.DebugFormat( | 1126 | m_log.DebugFormat( |
1071 | "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", | 1127 | "[XEngine] Loaded script {0}.{1}, item UUID {2}, prim UUID {3} @ {4}.{5}", |
1072 | part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, | 1128 | part.ParentGroup.RootPart.Name, item.Name, itemID, part.UUID, |