From 0f501629618fe1655b7ba653802056b5c32dbae6 Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Wed, 14 May 2008 21:53:40 +0000 Subject: * Refactor additional stats collection common code into base opensim server * If extra stats not sent to the viewer are available on an opensim server, they are now uniformly accessible using the 'show stats' command --- OpenSim/Framework/Servers/BaseOpenSimServer.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/Servers') diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 344309d..811a0db 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs @@ -27,6 +27,7 @@ using System; using OpenSim.Framework.Console; +using OpenSim.Framework.Statistics; namespace OpenSim.Framework.Servers { @@ -44,6 +45,11 @@ namespace OpenSim.Framework.Servers get { return m_httpServer; } } + /// + /// Holds the non-viewer statistics collection object for this service/server + /// + protected IStatsCollector m_stats; + public BaseOpenSimServer() { m_startuptime = DateTime.Now; @@ -72,6 +78,10 @@ namespace OpenSim.Framework.Servers { case "help": Notice("quit - equivalent to shutdown."); + + if (m_stats != null) + Notice("show stats - statistical information for this server"); + Notice("show uptime - show server startup and uptime."); Notice("shutdown - shutdown the server.\n"); break; @@ -97,7 +107,14 @@ namespace OpenSim.Framework.Servers public virtual void Show(string ShowWhat) { switch (ShowWhat) - { + { + case "stats": + if (m_stats != null) + { + Notice(m_stats.Report()); + } + break; + case "uptime": Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); -- cgit v1.1