Add sensor, dataserver requests, timer and listener counts to "xengine status" command.
This is for diagnostic purposes.0.7.4.1
parent
e9d8eb5a27
commit
98251cdab3
|
@ -151,6 +151,14 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
|
||||
#region IWorldComm Members
|
||||
|
||||
public int ListenerCount
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_listenerManager.ListenerCount;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a listen event callback with the specified filters.
|
||||
/// The parameters localID,itemID are needed to uniquely identify
|
||||
|
@ -438,6 +446,18 @@ namespace OpenSim.Region.CoreModules.Scripting.WorldComm
|
|||
private int m_maxhandles;
|
||||
private int m_curlisteners;
|
||||
|
||||
/// <summary>
|
||||
/// Total number of listeners
|
||||
/// </summary>
|
||||
public int ListenerCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (m_listeners)
|
||||
return m_listeners.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public ListenerManager(int maxlisteners, int maxhandles)
|
||||
{
|
||||
m_maxlisteners = maxlisteners;
|
||||
|
|
|
@ -49,6 +49,11 @@ namespace OpenSim.Region.Framework.Interfaces
|
|||
|
||||
public interface IWorldComm
|
||||
{
|
||||
/// <summary>
|
||||
/// Total number of listeners
|
||||
/// </summary>
|
||||
int ListenerCount { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create a listen event callback with the specified filters.
|
||||
/// The parameters localID,itemID are needed to uniquely identify
|
||||
|
|
|
@ -247,7 +247,58 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
|
||||
// Remove Sensors
|
||||
m_SensorRepeat[engine].UnSetSenseRepeaterEvents(localID, itemID);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the sensor repeat plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static SensorRepeat GetSensorRepeatPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_SensorRepeat.ContainsKey(engine))
|
||||
return m_SensorRepeat[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the dataserver plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Dataserver GetDataserverPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Dataserver.ContainsKey(engine))
|
||||
return m_Dataserver[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the timer plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Timer GetTimerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Timer.ContainsKey(engine))
|
||||
return m_Timer[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the listener plugin for this script engine.
|
||||
/// </summary>
|
||||
/// <param name="engine"></param>
|
||||
/// <returns></returns>
|
||||
public static Listener GetListenerPlugin(IScriptEngine engine)
|
||||
{
|
||||
if (m_Listener.ContainsKey(engine))
|
||||
return m_Listener[engine];
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object[] GetSerializationData(IScriptEngine engine, UUID itemID)
|
||||
|
@ -270,7 +321,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
data.AddRange(timers);
|
||||
}
|
||||
|
||||
Object[] sensors=m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
Object[] sensors = m_SensorRepeat[engine].GetSerializationData(itemID);
|
||||
if (sensors.Length > 0)
|
||||
{
|
||||
data.Add("sensor");
|
||||
|
|
|
@ -38,6 +38,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
{
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
public int DataserverRequestsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (DataserverRequests)
|
||||
return DataserverRequests.Count;
|
||||
}
|
||||
}
|
||||
|
||||
private Dictionary<string, DataserverRequest> DataserverRequests =
|
||||
new Dictionary<string, DataserverRequest>();
|
||||
|
||||
|
|
|
@ -42,22 +42,29 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
private IWorldComm m_commsPlugin;
|
||||
|
||||
public int ListenerCount
|
||||
{
|
||||
get { return m_commsPlugin.ListenerCount; }
|
||||
}
|
||||
|
||||
public Listener(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
m_commsPlugin = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
}
|
||||
|
||||
public void CheckListeners()
|
||||
{
|
||||
if (m_CmdManager.m_ScriptEngine.World == null)
|
||||
return;
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
if (comms != null)
|
||||
if (m_commsPlugin != null)
|
||||
{
|
||||
while (comms.HasMessages())
|
||||
while (m_commsPlugin.HasMessages())
|
||||
{
|
||||
ListenerInfo lInfo = (ListenerInfo)comms.GetNextMessage();
|
||||
ListenerInfo lInfo = (ListenerInfo)m_commsPlugin.GetNextMessage();
|
||||
|
||||
//Deliver data to prim's listen handler
|
||||
object[] resobj = new object[]
|
||||
|
@ -81,17 +88,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public Object[] GetSerializationData(UUID itemID)
|
||||
{
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
return comms.GetSerializationData(itemID);
|
||||
return m_commsPlugin.GetSerializationData(itemID);
|
||||
}
|
||||
|
||||
public void CreateFromData(uint localID, UUID itemID, UUID hostID,
|
||||
Object[] data)
|
||||
{
|
||||
IWorldComm comms = m_CmdManager.m_ScriptEngine.World.RequestModuleInterface<IWorldComm>();
|
||||
|
||||
comms.CreateFromData(localID, itemID, hostID, data);
|
||||
m_commsPlugin.CreateFromData(localID, itemID, hostID, data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -44,6 +44,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
/// <summary>
|
||||
/// Number of sensors active.
|
||||
/// </summary>
|
||||
public int SensorsCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (SenseRepeatListLock)
|
||||
return SenseRepeaters.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public SensorRepeat(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
|
|
|
@ -37,6 +37,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
|||
{
|
||||
public AsyncCommandManager m_CmdManager;
|
||||
|
||||
public int TimersCount
|
||||
{
|
||||
get
|
||||
{
|
||||
lock (TimerListLock)
|
||||
return Timers.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public Timer(AsyncCommandManager CmdManager)
|
||||
{
|
||||
m_CmdManager = CmdManager;
|
||||
|
|
|
@ -49,7 +49,10 @@ using OpenSim.Region.ScriptEngine.Shared;
|
|||
using OpenSim.Region.ScriptEngine.Shared.ScriptBase;
|
||||
using OpenSim.Region.ScriptEngine.Shared.CodeTools;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Instance;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api;
|
||||
using OpenSim.Region.ScriptEngine.Shared.Api.Plugins;
|
||||
using OpenSim.Region.ScriptEngine.Interfaces;
|
||||
using Timer = OpenSim.Region.ScriptEngine.Shared.Api.Plugins.Timer;
|
||||
|
||||
using ScriptCompileQueue = OpenSim.Framework.LocklessQueue<object[]>;
|
||||
|
||||
|
@ -386,6 +389,18 @@ namespace OpenSim.Region.ScriptEngine.XEngine
|
|||
sb.AppendFormat("Work items waiting : {0}\n", m_ThreadPool.WaitingCallbacks);
|
||||
// sb.AppendFormat("Assemblies loaded : {0}\n", m_Assemblies.Count);
|
||||
|
||||
SensorRepeat sr = AsyncCommandManager.GetSensorRepeatPlugin(this);
|
||||
sb.AppendFormat("Sensors : {0}\n", sr.SensorsCount);
|
||||
|
||||
Dataserver ds = AsyncCommandManager.GetDataserverPlugin(this);
|
||||
sb.AppendFormat("Dataserver requests : {0}\n", ds.DataserverRequestsCount);
|
||||
|
||||
Timer t = AsyncCommandManager.GetTimerPlugin(this);
|
||||
sb.AppendFormat("Timers : {0}\n", t.TimersCount);
|
||||
|
||||
Listener l = AsyncCommandManager.GetListenerPlugin(this);
|
||||
sb.AppendFormat("Listeners : {0}\n", l.ListenerCount);
|
||||
|
||||
MainConsole.Instance.OutputFormat(sb.ToString());
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue