aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XEngine
diff options
context:
space:
mode:
authorMelanie2012-12-07 03:49:04 +0000
committerMelanie2012-12-07 03:49:04 +0000
commit2cb824d3fcd37b9f9c9a9981702b81643c531a1b (patch)
tree8bfb77166642a49f142e60a3486a264e7635ef83 /OpenSim/Region/ScriptEngine/XEngine
parentMerge branch 'master' into careminster (diff)
parentMerge branch 'master' of ssh://opensimulator.org/var/git/opensim (diff)
downloadopensim-SC-2cb824d3fcd37b9f9c9a9981702b81643c531a1b.zip
opensim-SC-2cb824d3fcd37b9f9c9a9981702b81643c531a1b.tar.gz
opensim-SC-2cb824d3fcd37b9f9c9a9981702b81643c531a1b.tar.bz2
opensim-SC-2cb824d3fcd37b9f9c9a9981702b81643c531a1b.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/Avatar/InstantMessage/MessageTransferModule.cs OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/XEngine/XEngine.cs51
1 files changed, 39 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
index 9f05666..05ba890 100644
--- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
+++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs
@@ -31,6 +31,7 @@ using System.Collections.Generic;
31using System.Diagnostics; //for [DebuggerNonUserCode] 31using System.Diagnostics; //for [DebuggerNonUserCode]
32using System.Globalization; 32using System.Globalization;
33using System.IO; 33using System.IO;
34using System.Linq;
34using System.Reflection; 35using System.Reflection;
35using System.Security; 36using System.Security;
36using System.Security.Policy; 37using System.Security.Policy;
@@ -445,9 +446,21 @@ namespace OpenSim.Region.ScriptEngine.XEngine
445 /// </summary> 446 /// </summary>
446 /// <param name="cmdparams"></param> 447 /// <param name="cmdparams"></param>
447 /// <param name="instance"></param> 448 /// <param name="instance"></param>
448 /// <returns>true if we're okay to proceed, false if not.</returns> 449 /// <param name="comparer">Basis on which to sort output. Can be null if no sort needs to take place</param>
449 private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action) 450 private void HandleScriptsAction(string[] cmdparams, Action<IScriptInstance> action)
450 { 451 {
452 HandleScriptsAction<object>(cmdparams, action, null);
453 }
454
455 /// <summary>
456 /// Parse the raw item id into a script instance from the command params if it's present.
457 /// </summary>
458 /// <param name="cmdparams"></param>
459 /// <param name="instance"></param>
460 /// <param name="keySelector">Basis on which to sort output. Can be null if no sort needs to take place</param>
461 private void HandleScriptsAction<TKey>(
462 string[] cmdparams, Action<IScriptInstance> action, Func<IScriptInstance, TKey> keySelector)
463 {
451 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene)) 464 if (!(MainConsole.Instance.ConsoleScene == null || MainConsole.Instance.ConsoleScene == m_Scene))
452 return; 465 return;
453 466
@@ -458,7 +471,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine
458 471
459 if (cmdparams.Length == 2) 472 if (cmdparams.Length == 2)
460 { 473 {
461 foreach (IScriptInstance instance in m_Scripts.Values) 474 IEnumerable<IScriptInstance> scripts = m_Scripts.Values;
475
476 if (keySelector != null)
477 scripts = scripts.OrderBy<IScriptInstance, TKey>(keySelector);
478
479 foreach (IScriptInstance instance in scripts)
462 action(instance); 480 action(instance);
463 481
464 return; 482 return;
@@ -505,9 +523,20 @@ namespace OpenSim.Region.ScriptEngine.XEngine
505 StringBuilder sb = new StringBuilder(); 523 StringBuilder sb = new StringBuilder();
506 sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName); 524 sb.AppendFormat("Status of XEngine instance for {0}\n", m_Scene.RegionInfo.RegionName);
507 525
526 long scriptsLoaded, eventsQueued = 0, eventsProcessed = 0;
527
508 lock (m_Scripts) 528 lock (m_Scripts)
509 sb.AppendFormat("Scripts loaded : {0}\n", m_Scripts.Count); 529 {
530 scriptsLoaded = m_Scripts.Count;
510 531
532 foreach (IScriptInstance si in m_Scripts.Values)
533 {
534 eventsQueued += si.EventsQueued;
535 eventsProcessed += si.EventsProcessed;
536 }
537 }
538
539 sb.AppendFormat("Scripts loaded : {0}\n", scriptsLoaded);
511 sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count); 540 sb.AppendFormat("Unique scripts : {0}\n", m_uniqueScripts.Count);
512 sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count); 541 sb.AppendFormat("Scripts waiting for load : {0}\n", m_CompileQueue.Count);
513 sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads); 542 sb.AppendFormat("Max threads : {0}\n", m_ThreadPool.MaxThreads);
@@ -516,6 +545,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
516 sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads); 545 sb.AppendFormat("In use threads : {0}\n", m_ThreadPool.InUseThreads);
517 sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); 546 sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
518// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); 547// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
548 sb.AppendFormat("Events queued : {0}\n", eventsQueued);
549 sb.AppendFormat("Events processed : {0}\n", eventsProcessed);
519 550
520 SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this); 551 SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
521 sb.AppendFormat("Sensors : {0}\n", sr != null ? sr.SensorsCount : 0); 552 sb.AppendFormat("Sensors : {0}\n", sr != null ? sr.SensorsCount : 0);
@@ -546,7 +577,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
546 } 577 }
547 } 578 }
548 579
549 HandleScriptsAction(cmdparams, HandleShowScript); 580 HandleScriptsAction<long>(cmdparams, HandleShowScript, si => si.EventsProcessed);
550 } 581 }
551 582
552 private void HandleShowScript(IScriptInstance instance) 583 private void HandleShowScript(IScriptInstance instance)
@@ -576,10 +607,8 @@ namespace OpenSim.Region.ScriptEngine.XEngine
576 607
577 sb.AppendFormat("Script name : {0}\n", instance.ScriptName); 608 sb.AppendFormat("Script name : {0}\n", instance.ScriptName);
578 sb.AppendFormat("Status : {0}\n", status); 609 sb.AppendFormat("Status : {0}\n", status);
579 610 sb.AppendFormat("Queued events : {0}\n", instance.EventsQueued);
580 lock (eq) 611 sb.AppendFormat("Processed events : {0}\n", instance.EventsProcessed);
581 sb.AppendFormat("Queued events : {0}\n", eq.Count);
582
583 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID); 612 sb.AppendFormat("Item UUID : {0}\n", instance.ItemID);
584 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName); 613 sb.AppendFormat("Containing part name: {0}\n", instance.PrimName);
585 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID); 614 sb.AppendFormat("Containing part UUID: {0}\n", instance.ObjectID);
@@ -1089,8 +1118,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1089 1118
1090 string assembly = ""; 1119 string assembly = "";
1091 1120
1092 CultureInfo USCulture = new CultureInfo("en-US"); 1121 Culture.SetCurrentCulture();
1093 Thread.CurrentThread.CurrentCulture = USCulture;
1094 1122
1095 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap; 1123 Dictionary<KeyValuePair<int, int>, KeyValuePair<int, int>> linemap;
1096 1124
@@ -1504,8 +1532,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine
1504 /// <returns></returns> 1532 /// <returns></returns>
1505 private object ProcessEventHandler(object parms) 1533 private object ProcessEventHandler(object parms)
1506 { 1534 {
1507 CultureInfo USCulture = new CultureInfo("en-US"); 1535 Culture.SetCurrentCulture();
1508 Thread.CurrentThread.CurrentCulture = USCulture;
1509 1536
1510 IScriptInstance instance = (ScriptInstance) parms; 1537 IScriptInstance instance = (ScriptInstance) parms;
1511 1538