Add [Startup]LogShowStatsSeconds=n parameter which controls the interval

that simulator statistics is output to the console. Setting to zero turns
stats logging off.
bullet-2.82
Robert Adams 2014-06-13 21:27:07 -07:00
parent 31096fb1fe
commit 7f0adfd203
2 changed files with 16 additions and 2 deletions

View File

@ -45,6 +45,7 @@ using OpenSim.Framework.Monitoring;
using OpenSim.Framework.Servers; using OpenSim.Framework.Servers;
using OpenSim.Framework.Servers.HttpServer; using OpenSim.Framework.Servers.HttpServer;
using Timer=System.Timers.Timer; using Timer=System.Timers.Timer;
using Nini.Config;
namespace OpenSim.Framework.Servers 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 /// This will control a periodic log printout of the current 'show stats' (if they are active) for this
/// server. /// server.
/// </summary> /// </summary>
private int m_periodDiagnosticTimerMS = 60 * 60 * 1000;
private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
/// <summary> /// <summary>
@ -77,8 +79,6 @@ namespace OpenSim.Framework.Servers
// Random uuid for private data // Random uuid for private data
m_osSecret = UUID.Random().ToString(); m_osSecret = UUID.Random().ToString();
m_periodicDiagnosticsTimer.Elapsed += new ElapsedEventHandler(LogDiagnostics);
m_periodicDiagnosticsTimer.Enabled = true;
} }
/// <summary> /// <summary>
@ -89,6 +89,16 @@ namespace OpenSim.Framework.Servers
StatsManager.SimExtraStats = new SimExtraStatsCollector(); StatsManager.SimExtraStats = new SimExtraStatsCollector();
RegisterCommonCommands(); RegisterCommonCommands();
RegisterCommonComponents(Config); 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() protected override void ShutdownSpecific()

View File

@ -269,6 +269,10 @@
; PreJump is an additional animation state, but it probably ; PreJump is an additional animation state, but it probably
; won't look right until the physics engine supports it ; won't look right until the physics engine supports it
; (i.e delays takeoff for a moment) ; (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 ; Simulator Stats URI
; Enable JSON simulator data by setting a URI name (case sensitive) ; Enable JSON simulator data by setting a URI name (case sensitive)