diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 43 |
1 files changed, 28 insertions, 15 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index 605909d..cf19002 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -96,6 +96,11 @@ namespace OpenSim.Framework.Servers | |||
96 | get { return m_httpServer; } | 96 | get { return m_httpServer; } |
97 | } | 97 | } |
98 | 98 | ||
99 | /// <summary> | ||
100 | /// Holds the non-viewer statistics collection object for this service/server | ||
101 | /// </summary> | ||
102 | protected IStatsCollector m_stats; | ||
103 | |||
99 | public BaseOpenSimServer() | 104 | public BaseOpenSimServer() |
100 | { | 105 | { |
101 | m_startuptime = DateTime.Now; | 106 | m_startuptime = DateTime.Now; |
@@ -172,6 +177,10 @@ namespace OpenSim.Framework.Servers | |||
172 | "show info", | 177 | "show info", |
173 | "Show general information about the server", HandleShow); | 178 | "Show general information about the server", HandleShow); |
174 | 179 | ||
180 | m_console.Commands.AddCommand("General", false, "show stats", | ||
181 | "show stats", | ||
182 | "Show statistics", HandleShow); | ||
183 | |||
175 | m_console.Commands.AddCommand("General", false, "show threads", | 184 | m_console.Commands.AddCommand("General", false, "show threads", |
176 | "show threads", | 185 | "show threads", |
177 | "Show thread status", HandleShow); | 186 | "Show thread status", HandleShow); |
@@ -192,19 +201,8 @@ namespace OpenSim.Framework.Servers | |||
192 | "threads show", | 201 | "threads show", |
193 | "Show thread status. Synonym for \"show threads\"", | 202 | "Show thread status. Synonym for \"show threads\"", |
194 | (string module, string[] args) => Notice(GetThreadsReport())); | 203 | (string module, string[] args) => Notice(GetThreadsReport())); |
195 | |||
196 | m_console.Commands.AddCommand("General", false, "force gc", | ||
197 | "force gc", | ||
198 | "Manually invoke runtime garbage collection. For debugging purposes", | ||
199 | HandleForceGc); | ||
200 | } | 204 | } |
201 | } | 205 | } |
202 | |||
203 | private void HandleForceGc(string module, string[] args) | ||
204 | { | ||
205 | MainConsole.Instance.Output("Manually invoking runtime garbage collection"); | ||
206 | GC.Collect(); | ||
207 | } | ||
208 | 206 | ||
209 | /// <summary> | 207 | /// <summary> |
210 | /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing | 208 | /// Should be overriden and referenced by descendents if they need to perform extra shutdown processing |
@@ -228,7 +226,12 @@ namespace OpenSim.Framework.Servers | |||
228 | { | 226 | { |
229 | StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); | 227 | StringBuilder sb = new StringBuilder("DIAGNOSTICS\n\n"); |
230 | sb.Append(GetUptimeReport()); | 228 | sb.Append(GetUptimeReport()); |
231 | sb.Append(StatsManager.SimExtraStats.Report()); | 229 | |
230 | if (m_stats != null) | ||
231 | { | ||
232 | sb.Append(m_stats.Report()); | ||
233 | } | ||
234 | |||
232 | sb.Append(Environment.NewLine); | 235 | sb.Append(Environment.NewLine); |
233 | sb.Append(GetThreadsReport()); | 236 | sb.Append(GetThreadsReport()); |
234 | 237 | ||
@@ -379,6 +382,10 @@ namespace OpenSim.Framework.Servers | |||
379 | { | 382 | { |
380 | Notice("set log level [level] - change the console logging level only. For example, off or debug."); | 383 | Notice("set log level [level] - change the console logging level only. For example, off or debug."); |
381 | Notice("show info - show server information (e.g. startup path)."); | 384 | Notice("show info - show server information (e.g. startup path)."); |
385 | |||
386 | if (m_stats != null) | ||
387 | Notice("show stats - show statistical information for this server"); | ||
388 | |||
382 | Notice("show threads - list tracked threads"); | 389 | Notice("show threads - list tracked threads"); |
383 | Notice("show uptime - show server startup time and uptime."); | 390 | Notice("show uptime - show server startup time and uptime."); |
384 | Notice("show version - show server version."); | 391 | Notice("show version - show server version."); |
@@ -402,6 +409,11 @@ namespace OpenSim.Framework.Servers | |||
402 | ShowInfo(); | 409 | ShowInfo(); |
403 | break; | 410 | break; |
404 | 411 | ||
412 | case "stats": | ||
413 | if (m_stats != null) | ||
414 | Notice(m_stats.Report()); | ||
415 | break; | ||
416 | |||
405 | case "threads": | 417 | case "threads": |
406 | Notice(GetThreadsReport()); | 418 | Notice(GetThreadsReport()); |
407 | break; | 419 | break; |
@@ -592,7 +604,8 @@ namespace OpenSim.Framework.Servers | |||
592 | 604 | ||
593 | public string osSecret { | 605 | public string osSecret { |
594 | // Secret uuid for the simulator | 606 | // Secret uuid for the simulator |
595 | get { return m_osSecret; } | 607 | get { return m_osSecret; } |
608 | |||
596 | } | 609 | } |
597 | 610 | ||
598 | public string StatReport(IOSHttpRequest httpRequest) | 611 | public string StatReport(IOSHttpRequest httpRequest) |
@@ -600,11 +613,11 @@ namespace OpenSim.Framework.Servers | |||
600 | // If we catch a request for "callback", wrap the response in the value for jsonp | 613 | // If we catch a request for "callback", wrap the response in the value for jsonp |
601 | if (httpRequest.Query.ContainsKey("callback")) | 614 | if (httpRequest.Query.ContainsKey("callback")) |
602 | { | 615 | { |
603 | return httpRequest.Query["callback"].ToString() + "(" + StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; | 616 | return httpRequest.Query["callback"].ToString() + "(" + m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version) + ");"; |
604 | } | 617 | } |
605 | else | 618 | else |
606 | { | 619 | { |
607 | return StatsManager.SimExtraStats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); | 620 | return m_stats.XReport((DateTime.Now - m_startuptime).ToString() , m_version); |
608 | } | 621 | } |
609 | } | 622 | } |
610 | 623 | ||