diff options
author | Justin Clark-Casey (justincc) | 2012-03-06 23:21:17 +0000 |
---|---|---|
committer | Justin Clark-Casey (justincc) | 2012-03-06 23:21:17 +0000 |
commit | 98251cdab364baf20537a1b5a6260c68e6630ccf (patch) | |
tree | 698a491b8bbcdde88cd68b12e12b9db4bdaf180b /OpenSim/Region/ScriptEngine | |
parent | Remove unnecessary explicit ElapsedEventHandler in SimReporter (diff) | |
download | opensim-SC_OLD-98251cdab364baf20537a1b5a6260c68e6630ccf.zip opensim-SC_OLD-98251cdab364baf20537a1b5a6260c68e6630ccf.tar.gz opensim-SC_OLD-98251cdab364baf20537a1b5a6260c68e6630ccf.tar.bz2 opensim-SC_OLD-98251cdab364baf20537a1b5a6260c68e6630ccf.tar.xz |
Add sensor, dataserver requests, timer and listener counts to "xengine status" command.
This is for diagnostic purposes.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
6 files changed, 111 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs index 14edde4..993d10f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/AsyncCommandManager.cs | |||
@@ -247,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
247 | 247 | ||
248 | // Remove Sensors | 248 | // Remove Sensors |
249 | m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); | 249 | m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID); |
250 | } | ||
251 | |||
252 | /// <summary> | ||
253 | /// Get the sensor repeat plugin for this script engine. | ||
254 | /// </summary> | ||
255 | /// <param name="engine"></param> | ||
256 | /// <returns></returns> | ||
257 | public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine) | ||
258 | { | ||
259 | if (m_SensorRepeat.ContainsKey(engine)) | ||
260 | return m_SensorRepeat[engine]; | ||
261 | else | ||
262 | return null; | ||
263 | } | ||
250 | 264 | ||
265 | /// <summary> | ||
266 | /// Get the dataserver plugin for this script engine. | ||
267 | /// </summary> | ||
268 | /// <param name="engine"></param> | ||
269 | /// <returns></returns> | ||
270 | public static Dataserver GetDataserverPlugin(IScriptEngine engine) | ||
271 | { | ||
272 | if (m_Dataserver.ContainsKey(engine)) | ||
273 | return m_Dataserver[engine]; | ||
274 | else | ||
275 | return null; | ||
276 | } | ||
277 | |||
278 | /// <summary> | ||
279 | /// Get the timer plugin for this script engine. | ||
280 | /// </summary> | ||
281 | /// <param name="engine"></param> | ||
282 | /// <returns></returns> | ||
283 | public static Timer GetTimerPlugin(IScriptEngine engine) | ||
284 | { | ||
285 | if (m_Timer.ContainsKey(engine)) | ||
286 | return m_Timer[engine]; | ||
287 | else | ||
288 | return null; | ||
289 | } | ||
290 | |||
291 | /// <summary> | ||
292 | /// Get the listener plugin for this script engine. | ||
293 | /// </summary> | ||
294 | /// <param name="engine"></param> | ||
295 | /// <returns></returns> | ||
296 | public static Listener GetListenerPlugin(IScriptEngine engine) | ||
297 | { | ||
298 | if (m_Listener.ContainsKey(engine)) | ||
299 | return m_Listener[engine]; | ||
300 | else | ||
301 | return null; | ||
251 | } | 302 | } |
252 | 303 | ||
253 | public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) | 304 | public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID) |
@@ -270,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
270 | data.AddRange(timers); | 321 | data.AddRange(timers); |
271 | } | 322 | } |
272 | 323 | ||
273 | Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID); | 324 | Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID); |
274 | if (sensors.Length > 0) | 325 | if (sensors.Length > 0) |
275 | { | 326 | { |
276 | data.Add("sensor"); | 327 | data.Add("sensor"); |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs index 7fa19b1..9f78a49 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Dataserver.cs | |||
@@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
38 | { | 38 | { |
39 | public AsyncCommandManager m_CmdManager; | 39 | public AsyncCommandManager m_CmdManager; |
40 | 40 | ||
41 | public int DataserverRequestsCount | ||
42 | { | ||
43 | get | ||
44 | { | ||
45 | lock (DataserverRequests) | ||
46 | return DataserverRequests.Count; | ||
47 | } | ||
48 | } | ||
49 | |||
41 | private Dictionary<string, DataserverRequest> DataserverRequests = | 50 | private Dictionary<string, DataserverRequest> DataserverRequests = |
42 | new Dictionary<string, DataserverRequest>(); | 51 | new Dictionary<string, DataserverRequest>(); |
43 | 52 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs index 740816f..93e0261 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Listener.cs | |||
@@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
42 | 42 | ||
43 | public AsyncCommandManager m_CmdManager; | 43 | public AsyncCommandManager m_CmdManager; |
44 | 44 | ||
45 | private IWorldComm m_commsPlugin; | ||
46 | |||
47 | public int ListenerCount | ||
48 | { | ||
49 | get { return m_commsPlugin.ListenerCount; } | ||
50 | } | ||
51 | |||
45 | public Listener(AsyncCommandManager CmdManager) | 52 | public Listener(AsyncCommandManager CmdManager) |
46 | { | 53 | { |
47 | m_CmdManager = CmdManager; | 54 | m_CmdManager = CmdManager; |
55 | m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | ||
48 | } | 56 | } |
49 | 57 | ||
50 | public void CheckListeners() | 58 | public void CheckListeners() |
51 | { | 59 | { |
52 | if (m_CmdManager.m_ScriptEngine.World == null) | 60 | if (m_CmdManager.m_ScriptEngine.World == null) |
53 | return; | 61 | return; |
54 | IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | ||
55 | 62 | ||
56 | if (comms != null) | 63 | if (m_commsPlugin != null) |
57 | { | 64 | { |
58 | while (comms.HasMessages()) | 65 | while (m_commsPlugin.HasMessages()) |
59 | { | 66 | { |
60 | ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage(); | 67 | ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage(); |
61 | 68 | ||
62 | //Deliver data to prim's listen handler | 69 | //Deliver data to prim's listen handler |
63 | object[] resobj = new object[] | 70 | object[] resobj = new object[] |
@@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
81 | 88 | ||
82 | public Object[] GetSerializationData(UUID itemID) | 89 | public Object[] GetSerializationData(UUID itemID) |
83 | { | 90 | { |
84 | IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 91 | return m_commsPlugin.GetSerializationData(itemID); |
85 | |||
86 | return comms.GetSerializationData(itemID); | ||
87 | } | 92 | } |
88 | 93 | ||
89 | public void CreateFromData(uint localID, UUID itemID, UUID hostID, | 94 | public void CreateFromData(uint localID, UUID itemID, UUID hostID, |
90 | Object[] data) | 95 | Object[] data) |
91 | { | 96 | { |
92 | IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>(); | 97 | m_commsPlugin.CreateFromData(localID, itemID, hostID, data); |
93 | |||
94 | comms.CreateFromData(localID, itemID, hostID, data); | ||
95 | } | 98 | } |
96 | } | 99 | } |
97 | } | 100 | } \ No newline at end of file |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs index fbb7c39..1c272f8 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs | |||
@@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
44 | 44 | ||
45 | public AsyncCommandManager m_CmdManager; | 45 | public AsyncCommandManager m_CmdManager; |
46 | 46 | ||
47 | /// <summary> | ||
48 | /// Number of sensors active. | ||
49 | /// </summary> | ||
50 | public int SensorsCount | ||
51 | { | ||
52 | get | ||
53 | { | ||
54 | lock (SenseRepeatListLock) | ||
55 | return SenseRepeaters.Count; | ||
56 | } | ||
57 | } | ||
58 | |||
47 | public SensorRepeat(AsyncCommandManager CmdManager) | 59 | public SensorRepeat(AsyncCommandManager CmdManager) |
48 | { | 60 | { |
49 | m_CmdManager = CmdManager; | 61 | m_CmdManager = CmdManager; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs index eeb59d9..bc63030 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/Timer.cs | |||
@@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins | |||
37 | { | 37 | { |
38 | public AsyncCommandManager m_CmdManager; | 38 | public AsyncCommandManager m_CmdManager; |
39 | 39 | ||
40 | public int TimersCount | ||
41 | { | ||
42 | get | ||
43 | { | ||
44 | lock (TimerListLock) | ||
45 | return Timers.Count; | ||
46 | } | ||
47 | } | ||
48 | |||
40 | public Timer(AsyncCommandManager CmdManager) | 49 | public Timer(AsyncCommandManager CmdManager) |
41 | { | 50 | { |
42 | m_CmdManager = CmdManager; | 51 | m_CmdManager = CmdManager; |
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index c68f03f..d1cac9c 100644 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -49,7 +49,10 @@ using OpenSim.Region.ScriptEngine.Shared; | |||
49 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; | 49 | using OpenSim.Region.ScriptEngine.Shared.ScriptBase; |
50 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; | 50 | using OpenSim.Region.ScriptEngine.Shared.CodeTools; |
51 | using OpenSim.Region.ScriptEngine.Shared.Instance; | 51 | using OpenSim.Region.ScriptEngine.Shared.Instance; |
52 | using OpenSim.Region.ScriptEngine.Shared.Api; | ||
53 | using OpenSim.Region.ScriptEngine.Shared.Api.Plugins; | ||
52 | using OpenSim.Region.ScriptEngine.Interfaces; | 54 | using OpenSim.Region.ScriptEngine.Interfaces; |
55 | using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer; | ||
53 | 56 | ||
54 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; | 57 | using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>; |
55 | 58 | ||
@@ -386,6 +389,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
386 | sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); | 389 | sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks); |
387 | // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); | 390 | // sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count); |
388 | 391 | ||
392 | SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this); | ||
393 | sb.AppendFormat("Sensors : {0}\n", sr.SensorsCount); | ||
394 | |||
395 | Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this); | ||
396 | sb.AppendFormat("Dataserver requests : {0}\n", ds.DataserverRequestsCount); | ||
397 | |||
398 | Timer t = AsyncCommandManager.GetTimerPlugin(this); | ||
399 | sb.AppendFormat("Timers : {0}\n", t.TimersCount); | ||
400 | |||
401 | Listener l = AsyncCommandManager.GetListenerPlugin(this); | ||
402 | sb.AppendFormat("Listeners : {0}\n", l.ListenerCount); | ||
403 | |||
389 | MainConsole.Instance.OutputFormat(sb.ToString()); | 404 | MainConsole.Instance.OutputFormat(sb.ToString()); |
390 | } | 405 | } |
391 | 406 | ||