From e0f28ac5ba10f061446da51d61fbcd0bbb1a8a68 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Tue, 8 Mar 2011 12:59:46 -0800 Subject: [PATCH] Basic SyncConnector status for ssync status --- .../SymmetricSync/RegionSyncModule.cs | 7 ++-- .../SymmetricSync/ScriptEngineSyncModule.cs | 2 +- .../SymmetricSync/SyncConnector.cs | 33 ++++++++++++++++--- 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs index dd13272bcc..ff80d1ef9c 100644 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/RegionSyncModule.cs @@ -1163,8 +1163,11 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void SyncStatus(Object[] args) { - //TO BE IMPLEMENTED - m_log.Warn("[REGION SYNC MODULE]: SyncStatus() TO BE IMPLEMENTED !!!"); + m_log.WarnFormat("[REGION SYNC MODULE]: Description: {0}", SyncConnector.StatusTitle()); + ForEachSyncConnector(delegate(SyncConnector connector) + { + m_log.WarnFormat("{0}: {1}: {2}", "[REGION SYNC MODULE}", connector.Description, connector.StatusLine()); + }); } private void SyncDebug(Object[] args) diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs index e10292d5ec..30cda59a49 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/ScriptEngineSyncModule.cs @@ -172,7 +172,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule { if (entity is SceneObjectGroup) { - m_log.Warn(LogHeader + ": start script for obj " + entity.UUID); + m_log.Debug(LogHeader + ": start script for obj " + entity.UUID); SceneObjectGroup sog = (SceneObjectGroup)entity; sog.CreateScriptInstances(0, false, m_scene.DefaultScriptEngine, 0); sog.ResumeScripts(); diff --git a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs index 93a5dab3c8..817a250d4a 100755 --- a/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs +++ b/OpenSim/Region/CoreModules/RegionSync/RegionSyncModule/SymmetricSync/SyncConnector.cs @@ -33,7 +33,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private long msgsOut=0; private long bytesIn=0; private long bytesOut=0; - private int msgCount = 0; + private DateTime lastStatTime; // A queue for outgoing traffic. private BlockingUpdateQueue m_outQ = new BlockingUpdateQueue(); @@ -69,8 +69,9 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule get { if (m_syncOtherSideRegionName == null) - return String.Format("SyncConnector #{0}", m_connectorNum); - return String.Format("SyncConnector #{0} (Actor {2}, Region {1:10})", m_connectorNum, m_syncOtherSideRegionName, m_syncOtherSideActorID); + return String.Format("SyncConnector#{0}", m_connectorNum); + return String.Format("SyncConnector#{0}(A={2},R={1:10})", + m_connectorNum, m_syncOtherSideRegionName, m_syncOtherSideActorID); } } @@ -84,6 +85,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_tcpConnection = tcpclient; m_connectorNum = connectorNum; m_regionSyncModule = syncModule; + lastStatTime = DateTime.Now; m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); } @@ -97,6 +99,7 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule m_remoteListenerInfo = listenerInfo; m_connectorNum = connectorNum; m_regionSyncModule = syncModule; + lastStatTime = DateTime.Now; m_log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); } @@ -261,7 +264,8 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule private void HandleMessage(SymmetricSyncMessage msg) { - msgCount++; + msgsIn++; + bytesIn += msg.Data.Length; switch (msg.Type) { case SymmetricSyncMessage.MsgType.RegionName: @@ -294,5 +298,26 @@ namespace OpenSim.Region.CoreModules.RegionSync.RegionSyncModule //Later on, we may deliver messages to different modules, say sync message to RegionSyncModule and event message to ActorSyncModule. m_regionSyncModule.HandleIncomingMessage(msg, m_syncOtherSideActorID); } + + public string StatusLine() + { + string statLine = ""; + lock (stats) + { + double secondsSinceLastStats = DateTime.Now.Subtract(lastStatTime).TotalSeconds; + lastStatTime = DateTime.Now; + statLine = String.Format("{0},{1},{2},{3},{4},{5},{6}", + msgsIn, msgsOut, bytesIn, bytesOut, m_outQ.Count, + 8 * (bytesIn / secondsSinceLastStats / 1000000), + 8 * (bytesOut / secondsSinceLastStats / 1000000) ); + msgsIn = msgsOut = bytesIn = bytesOut = 0; + } + return statLine; + } + + public static string StatusTitle() + { + return "msgsIn,msgsOut,queueSize,Mbps In,Mbps Out"; + } } } \ No newline at end of file