From 7f0adfd20390032b27778b8c4c23a666264ac0ba Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 13 Jun 2014 21:27:07 -0700 Subject: Add [Startup]LogShowStatsSeconds=n parameter which controls the interval that simulator statistics is output to the console. Setting to zero turns stats logging off. --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 566772d..54e6061 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -45,6 +45,7 @@ using OpenSim.Framework.Monitoring; using OpenSim.Framework.Servers; using OpenSim.Framework.Servers.HttpServer; using Timer=System.Timers.Timer; +using Nini.Config; namespace OpenSim.Framework.Servers { @@ -59,6 +60,7 @@ namespace OpenSim.Framework.Servers /// This will control a periodic log printout of the current 'show stats' (if they are active) for this /// server. /// + private int m_periodDiagnosticTimerMS = 60 * 60 * 1000; private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); /// @@ -77,8 +79,6 @@ namespace OpenSim.Framework.Servers // Random uuid for private data m_osSecret = UUID.Random().ToString(); - m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); - m_periodicDiagnosticsTimer.Enabled = true; } /// @@ -89,6 +89,16 @@ namespace OpenSim.Framework.Servers StatsManager.SimExtraStats = new SimExtraStatsCollector(); RegisterCommonCommands(); RegisterCommonComponents(Config); + + IConfig startupConfig = Config.Configs["Startup"]; + int logShowStatsSeconds = startupConfig.GetInt("LogShowStatsSeconds", m_periodDiagnosticTimerMS / 1000); + m_periodDiagnosticTimerMS = logShowStatsSeconds * 1000; + m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics); + if (m_periodDiagnosticTimerMS != 0) + { + m_periodicDiagnosticsTimer.Interval = m_periodDiagnosticTimerMS; + m_periodicDiagnosticsTimer.Enabled = true; + } } protected override void ShutdownSpecific() -- cgit v1.1