* Move thread tracking code to base opensim server so that it's available for all servers (UGAIM as well as Region)
* This will work as long as those servers are actually registering any threads they use (does not include stuff plucked from the thread pool) * command is now "show threads" rather than threads0.6.0-stable
parent
8535cb52e0
commit
f7d9b0bab7
|
@ -26,9 +26,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Threading;
|
||||||
using System.Timers;
|
using System.Timers;
|
||||||
using log4net;
|
using log4net;
|
||||||
using OpenSim.Framework.Console;
|
using OpenSim.Framework.Console;
|
||||||
|
@ -47,7 +49,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 Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000);
|
private System.Timers.Timer m_periodicDiagnosticsTimer = new System.Timers.Timer(60 * 60 * 1000);
|
||||||
|
|
||||||
protected ConsoleBase m_console;
|
protected ConsoleBase m_console;
|
||||||
|
|
||||||
|
@ -154,6 +156,7 @@ namespace OpenSim.Framework.Servers
|
||||||
if (m_stats != null)
|
if (m_stats != null)
|
||||||
Notice("show stats - show statistical information for this server");
|
Notice("show stats - show statistical information for this server");
|
||||||
|
|
||||||
|
Notice("show threads - list tracked threads");
|
||||||
Notice("show uptime - show server startup time and uptime.");
|
Notice("show uptime - show server startup time and uptime.");
|
||||||
Notice("show version - show server version.");
|
Notice("show version - show server version.");
|
||||||
Notice("shutdown - shutdown the server.\n");
|
Notice("shutdown - shutdown the server.\n");
|
||||||
|
@ -194,13 +197,35 @@ namespace OpenSim.Framework.Servers
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case "threads":
|
||||||
|
// m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:");
|
||||||
|
// int _tc = 0;
|
||||||
|
|
||||||
|
// foreach (ProcessThread pt in Process.GetCurrentProcess().Threads)
|
||||||
|
// {
|
||||||
|
// _tc++;
|
||||||
|
// m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString());
|
||||||
|
// }
|
||||||
|
|
||||||
|
List<Thread> threads = ThreadTracker.GetThreads();
|
||||||
|
if (threads == null)
|
||||||
|
{
|
||||||
|
Notice("Thread tracking is only enabled in DEBUG mode.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int tc = 0;
|
||||||
|
Notice(threads.Count + " threads are being tracked:");
|
||||||
|
foreach (Thread t in threads)
|
||||||
|
{
|
||||||
|
tc++;
|
||||||
|
Notice(tc + ": ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case "uptime":
|
case "uptime":
|
||||||
Notice(GetUptimeReport());
|
Notice(GetUptimeReport());
|
||||||
/*
|
|
||||||
Notice("Time now is " + DateTime.Now);
|
|
||||||
Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString());
|
|
||||||
Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString());
|
|
||||||
*/
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "version":
|
case "version":
|
||||||
|
|
|
@ -295,7 +295,6 @@ namespace OpenSim
|
||||||
m_console.Notice("show users - show info about connected users.");
|
m_console.Notice("show users - show info about connected users.");
|
||||||
m_console.Notice("show modules - shows info about loaded modules.");
|
m_console.Notice("show modules - shows info about loaded modules.");
|
||||||
m_console.Notice("show regions - show running region information.");
|
m_console.Notice("show regions - show running region information.");
|
||||||
m_console.Notice("threads - list threads");
|
|
||||||
m_console.Notice("config set section field value - set a config value");
|
m_console.Notice("config set section field value - set a config value");
|
||||||
m_console.Notice("config get section field - get a config value");
|
m_console.Notice("config get section field - get a config value");
|
||||||
m_console.Notice("config save - save OpenSim.ini");
|
m_console.Notice("config save - save OpenSim.ini");
|
||||||
|
@ -303,33 +302,6 @@ namespace OpenSim
|
||||||
ShowPluginCommandsHelp(CombineParams(cmdparams, 0), m_console);
|
ShowPluginCommandsHelp(CombineParams(cmdparams, 0), m_console);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "threads":
|
|
||||||
// m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:");
|
|
||||||
// int _tc = 0;
|
|
||||||
|
|
||||||
// foreach (ProcessThread pt in Process.GetCurrentProcess().Threads)
|
|
||||||
// {
|
|
||||||
// _tc++;
|
|
||||||
// m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString());
|
|
||||||
// }
|
|
||||||
|
|
||||||
List<Thread> threads = ThreadTracker.GetThreads();
|
|
||||||
if (threads == null)
|
|
||||||
{
|
|
||||||
m_console.Notice("THREAD", "Thread tracking is only enabled in DEBUG mode.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int _tc = 0;
|
|
||||||
m_console.Notice("THREAD", threads.Count + " threads are being tracked:");
|
|
||||||
foreach (Thread t in threads)
|
|
||||||
{
|
|
||||||
_tc++;
|
|
||||||
m_console.Notice("THREAD", _tc + ": ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
case "save-xml":
|
case "save-xml":
|
||||||
m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
|
m_log.Error("[CONSOLE]: PLEASE NOTE, save-xml is DEPRECATED and may be REMOVED soon. If you are using this and there is some reason you can't use save-xml2, please file a mantis detailing the reason.");
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue