From 02980336a38c8288e40a7fefb05be87a443f6a45 Mon Sep 17 00:00:00 2001 From: Robert Adams Date: Fri, 13 Jun 2014 21:27:07 -0700 Subject: [PATCH] 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 ++++++++++++-- bin/OpenSimDefaults.ini | 4 ++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 566772d869..54e6061bb6 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() diff --git a/bin/OpenSimDefaults.ini b/bin/OpenSimDefaults.ini index 7f6d0e6e97..2ee052bff6 100644 --- a/bin/OpenSimDefaults.ini +++ b/bin/OpenSimDefaults.ini @@ -269,6 +269,10 @@ ; PreJump is an additional animation state, but it probably ; won't look right until the physics engine supports it ; (i.e delays takeoff for a moment) + + ; Simulator statistics are output to the console periodically at debug level INFO. + ; Setting this to zero disables this output. + ; LogShowStatsSeconds = 3600 ; Simulator Stats URI ; Enable JSON simulator data by setting a URI name (case sensitive)