From 20f26eeb17da708a58a26629e8e9b08a5e9a6950 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 17:38:55 +0000 Subject: Remove unused RegionCommsListener/IRegionCommsListener. All this is now being handled through IEntityTransferModule and SimulationService instead, and has been for some time. --- OpenSim/Framework/IRegionCommsListener.cs | 68 ---------- OpenSim/Framework/RegionCommsListener.cs | 204 ------------------------------ 2 files changed, 272 deletions(-) delete mode 100644 OpenSim/Framework/IRegionCommsListener.cs delete mode 100644 OpenSim/Framework/RegionCommsListener.cs (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/IRegionCommsListener.cs b/OpenSim/Framework/IRegionCommsListener.cs deleted file mode 100644 index cd59c63..0000000 --- a/OpenSim/Framework/IRegionCommsListener.cs +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System.Collections.Generic; -using OpenMetaverse; - -namespace OpenSim.Framework -{ - public delegate void ExpectUserDelegate(AgentCircuitData agent); - - - public delegate void UpdateNeighbours(List neighbours); - - public delegate void AgentCrossing(UUID agentID, Vector3 position, bool isFlying); - - public delegate void PrimCrossing(UUID primID, Vector3 position, bool isPhysical); - - public delegate void AcknowledgeAgentCross(UUID agentID); - - public delegate void AcknowledgePrimCross(UUID PrimID); - - public delegate bool CloseAgentConnection(UUID agentID); - - public delegate bool ChildAgentUpdate(ChildAgentDataUpdate cAgentData); - - public delegate void LogOffUser(UUID agentID, UUID regionSecret, string message); - - public delegate LandData GetLandData(uint x, uint y); - - public interface IRegionCommsListener - { - event ExpectUserDelegate OnExpectUser; - event GenericCall2 OnExpectChildAgent; - event AgentCrossing OnAvatarCrossingIntoRegion; - event PrimCrossing OnPrimCrossingIntoRegion; - event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; - event AcknowledgePrimCross OnAcknowledgePrimCrossed; - event UpdateNeighbours OnNeighboursUpdate; - event CloseAgentConnection OnCloseAgentConnection; - event ChildAgentUpdate OnChildAgentUpdate; - event LogOffUser OnLogOffUser; - event GetLandData OnGetLandData; - } -} diff --git a/OpenSim/Framework/RegionCommsListener.cs b/OpenSim/Framework/RegionCommsListener.cs deleted file mode 100644 index 3e0955d..0000000 --- a/OpenSim/Framework/RegionCommsListener.cs +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright (c) Contributors, http://opensimulator.org/ - * See CONTRIBUTORS.TXT for a full list of copyright holders. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the OpenSimulator Project nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -using System; -using System.Collections.Generic; -using OpenMetaverse; - -namespace OpenSim.Framework -{ - /// - /// Sandbox mode region comms listener. There is one of these per region - /// - public class RegionCommsListener : IRegionCommsListener - { - public string debugRegionName = String.Empty; - private AcknowledgeAgentCross handlerAcknowledgeAgentCrossed = null; // OnAcknowledgeAgentCrossed; - private AcknowledgePrimCross handlerAcknowledgePrimCrossed = null; // OnAcknowledgePrimCrossed; - private AgentCrossing handlerAvatarCrossingIntoRegion = null; // OnAvatarCrossingIntoRegion; - private ChildAgentUpdate handlerChildAgentUpdate = null; // OnChildAgentUpdate; - private CloseAgentConnection handlerCloseAgentConnection = null; // OnCloseAgentConnection; - private GenericCall2 handlerExpectChildAgent = null; // OnExpectChildAgent; - private ExpectUserDelegate handlerExpectUser = null; // OnExpectUser - private UpdateNeighbours handlerNeighboursUpdate = null; // OnNeighboursUpdate; -// private PrimCrossing handlerPrimCrossingIntoRegion = null; // OnPrimCrossingIntoRegion; - private LogOffUser handlerLogOffUser = null; - private GetLandData handlerGetLandData = null; - - #region IRegionCommsListener Members - - public event ExpectUserDelegate OnExpectUser; - public event GenericCall2 OnExpectChildAgent; - public event AgentCrossing OnAvatarCrossingIntoRegion; - public event PrimCrossing OnPrimCrossingIntoRegion; - public event UpdateNeighbours OnNeighboursUpdate; - public event AcknowledgeAgentCross OnAcknowledgeAgentCrossed; - public event AcknowledgePrimCross OnAcknowledgePrimCrossed; - public event CloseAgentConnection OnCloseAgentConnection; - public event ChildAgentUpdate OnChildAgentUpdate; - public event LogOffUser OnLogOffUser; - public event GetLandData OnGetLandData; - - #endregion - - /// - /// - /// - /// - /// - public virtual bool TriggerExpectUser(AgentCircuitData agent) - { - handlerExpectUser = OnExpectUser; - if (handlerExpectUser != null) - { - handlerExpectUser(agent); - return true; - } - - return false; - } - - // From User Server - public virtual void TriggerLogOffUser(UUID agentID, UUID RegionSecret, string message) - { - handlerLogOffUser = OnLogOffUser; - if (handlerLogOffUser != null) - { - handlerLogOffUser(agentID, RegionSecret, message); - } - - } - - public virtual bool TriggerChildAgentUpdate(ChildAgentDataUpdate cAgentData) - { - handlerChildAgentUpdate = OnChildAgentUpdate; - if (handlerChildAgentUpdate != null) - { - handlerChildAgentUpdate(cAgentData); - return true; - } - return false; - } - - public virtual bool TriggerExpectAvatarCrossing(UUID agentID, Vector3 position, bool isFlying) - { - handlerAvatarCrossingIntoRegion = OnAvatarCrossingIntoRegion; - if (handlerAvatarCrossingIntoRegion != null) - { - handlerAvatarCrossingIntoRegion(agentID, position, isFlying); - return true; - } - return false; - } - - public virtual bool TriggerAcknowledgeAgentCrossed(UUID agentID) - { - handlerAcknowledgeAgentCrossed = OnAcknowledgeAgentCrossed; - if (handlerAcknowledgeAgentCrossed != null) - { - handlerAcknowledgeAgentCrossed(agentID); - return true; - } - return false; - } - - public virtual bool TriggerAcknowledgePrimCrossed(UUID primID) - { - handlerAcknowledgePrimCrossed = OnAcknowledgePrimCrossed; - if (handlerAcknowledgePrimCrossed != null) - { - handlerAcknowledgePrimCrossed(primID); - return true; - } - return false; - } - - public virtual bool TriggerCloseAgentConnection(UUID agentID) - { - handlerCloseAgentConnection = OnCloseAgentConnection; - if (handlerCloseAgentConnection != null) - { - handlerCloseAgentConnection(agentID); - return true; - } - return false; - } - - /// - /// - /// - /// TODO: Doesnt take any args?? - /// - public virtual bool TriggerExpectChildAgent() - { - handlerExpectChildAgent = OnExpectChildAgent; - if (handlerExpectChildAgent != null) - { - handlerExpectChildAgent(); - return true; - } - - return false; - } - - /// - /// - /// - /// Added to avoid a unused compiler warning on OnNeighboursUpdate, TODO: Check me - /// - /// - public virtual bool TriggerOnNeighboursUpdate(List neighbours) - { - handlerNeighboursUpdate = OnNeighboursUpdate; - if (handlerNeighboursUpdate != null) - { - handlerNeighboursUpdate(neighbours); - return true; - } - - return false; - } - - public bool TriggerTellRegionToCloseChildConnection(UUID agentID) - { - handlerCloseAgentConnection = OnCloseAgentConnection; - if (handlerCloseAgentConnection != null) - return handlerCloseAgentConnection(agentID); - - return false; - } - - public LandData TriggerGetLandData(uint x, uint y) - { - handlerGetLandData = OnGetLandData; - if (handlerGetLandData != null) - return handlerGetLandData(x, y); - - return null; - } - } -} -- cgit v1.1 From 7db38a351c19341e7332dc95cdab5db84ef48226 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 21:49:13 +0000 Subject: Add number of milliseconds since last update to "show threads" --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 10 +++++++--- OpenSim/Framework/Watchdog.cs | 12 +++++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 3d20080..65d4d32 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -247,13 +247,17 @@ namespace OpenSim.Framework.Servers Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); sb.Append(threads.Length + " threads are being tracked:" + Environment.NewLine); + + int timeNow = Util.EnvironmentTickCount(); + foreach (Watchdog.ThreadWatchdogInfo twi in threads) { Thread t = twi.Thread; - sb.Append( - "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", TimeRunning: " - + "Pri: " + t.Priority + ", State: " + t.ThreadState); + sb.AppendFormat( + "ID: {0}, Name: {1}, Last Update: {2} ms ago, Pri: {3}, State: {4}", + t.ManagedThreadId, t.Name, timeNow - twi.LastTick, t.Priority, t.ThreadState); + sb.Append(Environment.NewLine); } diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 8e82f5a..0ee0c5b 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -48,6 +48,15 @@ namespace OpenSim.Framework public class ThreadWatchdogInfo { public Thread Thread { get; private set; } + + /// + /// Approximate tick when this thread was started. + /// + public int StartTick { get; private set; } + + /// + /// Last time this heartbeat update was invoked + /// public int LastTick { get; set; } /// @@ -64,7 +73,8 @@ namespace OpenSim.Framework { Thread = thread; Timeout = timeout; - LastTick = Environment.TickCount & Int32.MaxValue; + StartTick = Environment.TickCount & Int32.MaxValue; + LastTick = StartTick; } } -- cgit v1.1 From ccae787d03c7033df9f59cc16828ddd315374d01 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 22:20:44 +0000 Subject: send a watchdog heartbeat for a poll worker thread when it's actually run --- OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs index 16e56d2..5e171f0 100644 --- a/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs +++ b/OpenSim/Framework/Servers/HttpServer/PollServiceWorkerThread.cs @@ -69,6 +69,9 @@ namespace OpenSim.Framework.Servers.HttpServer while (m_running) { PollServiceHttpRequest req = m_request.Dequeue(); + + Watchdog.UpdateThread(); + try { if (req.PollServiceArgs.HasEvents(req.RequestID, req.PollServiceArgs.Id)) -- cgit v1.1 From 29eb3b2eb57a43e9959486fb371d81a60ccab921 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 22:51:12 +0000 Subject: improve formatting of "show threads" --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 65d4d32..41a0e4e 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -243,6 +243,9 @@ namespace OpenSim.Framework.Servers /// protected string GetThreadsReport() { + // This should be a constant field. + string reportFormat = "{0,6} {1,35} {2,16} {3,10} {4,30}"; + StringBuilder sb = new StringBuilder(); Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); @@ -250,12 +253,16 @@ namespace OpenSim.Framework.Servers int timeNow = Util.EnvironmentTickCount(); + sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "PRIORITY", "STATE"); + sb.Append(Environment.NewLine); + foreach (Watchdog.ThreadWatchdogInfo twi in threads) { Thread t = twi.Thread; sb.AppendFormat( - "ID: {0}, Name: {1}, Last Update: {2} ms ago, Pri: {3}, State: {4}", + reportFormat, + //t.ManagedThreadId, t.Name, string.Format("{0} ms", timeNow - twi.LastTick), t.Priority, t.ThreadState); t.ManagedThreadId, t.Name, timeNow - twi.LastTick, t.Priority, t.ThreadState); sb.Append(Environment.NewLine); -- cgit v1.1 From aea547cd11e4baa24cad12e13160e5ff2250a69f Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Tue, 15 Nov 2011 23:24:51 +0000 Subject: fix build break on UserManagementModule. This also adds time since started to "show threads". Unfortunately these two changes got mixed in. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 12 ++++++++---- OpenSim/Framework/Watchdog.cs | 11 +++++++---- 2 files changed, 15 insertions(+), 8 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 41a0e4e..db063f1 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -244,7 +244,7 @@ namespace OpenSim.Framework.Servers protected string GetThreadsReport() { // This should be a constant field. - string reportFormat = "{0,6} {1,35} {2,16} {3,10} {4,30}"; + string reportFormat = "{0,6} {1,35} {2,16} {3,13} {4,10} {5,30}"; StringBuilder sb = new StringBuilder(); Watchdog.ThreadWatchdogInfo[] threads = Watchdog.GetThreads(); @@ -253,7 +253,7 @@ namespace OpenSim.Framework.Servers int timeNow = Util.EnvironmentTickCount(); - sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "PRIORITY", "STATE"); + sb.AppendFormat(reportFormat, "ID", "NAME", "LAST UPDATE (MS)", "LIFETIME (MS)", "PRIORITY", "STATE"); sb.Append(Environment.NewLine); foreach (Watchdog.ThreadWatchdogInfo twi in threads) @@ -262,8 +262,12 @@ namespace OpenSim.Framework.Servers sb.AppendFormat( reportFormat, - //t.ManagedThreadId, t.Name, string.Format("{0} ms", timeNow - twi.LastTick), t.Priority, t.ThreadState); - t.ManagedThreadId, t.Name, timeNow - twi.LastTick, t.Priority, t.ThreadState); + t.ManagedThreadId, + t.Name, + timeNow - twi.LastTick, + timeNow - twi.FirstTick, + t.Priority, + t.ThreadState); sb.Append(Environment.NewLine); } diff --git a/OpenSim/Framework/Watchdog.cs b/OpenSim/Framework/Watchdog.cs index 0ee0c5b..2dd6ebe 100644 --- a/OpenSim/Framework/Watchdog.cs +++ b/OpenSim/Framework/Watchdog.cs @@ -52,10 +52,13 @@ namespace OpenSim.Framework /// /// Approximate tick when this thread was started. /// - public int StartTick { get; private set; } + /// + /// Not terribly good since this quickly wraps around. + /// + public int FirstTick { get; private set; } /// - /// Last time this heartbeat update was invoked + /// First time this heartbeat update was invoked /// public int LastTick { get; set; } @@ -73,8 +76,8 @@ namespace OpenSim.Framework { Thread = thread; Timeout = timeout; - StartTick = Environment.TickCount & Int32.MaxValue; - LastTick = StartTick; + FirstTick = Environment.TickCount & Int32.MaxValue; + LastTick = FirstTick; } } -- cgit v1.1