diff options
author | Justin Clarke Casey | 2008-07-11 16:24:52 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-07-11 16:24:52 +0000 |
commit | f7d9b0bab710693417fa653e3dcf26374c93d100 (patch) | |
tree | 0958369b6bcff431a630fbf84cd3f4320db9298e /OpenSim | |
parent | * Put an info entry in the log if permissions are being bypassed (diff) | |
download | opensim-SC-f7d9b0bab710693417fa653e3dcf26374c93d100.zip opensim-SC-f7d9b0bab710693417fa653e3dcf26374c93d100.tar.gz opensim-SC-f7d9b0bab710693417fa653e3dcf26374c93d100.tar.bz2 opensim-SC-f7d9b0bab710693417fa653e3dcf26374c93d100.tar.xz |
* 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 threads
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 37 | ||||
-rw-r--r-- | OpenSim/Region/Application/OpenSim.cs | 28 |
2 files changed, 31 insertions, 34 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs index dac784e..c61db33 100644 --- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs +++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs | |||
@@ -26,9 +26,11 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | ||
29 | using System.IO; | 30 | using System.IO; |
30 | using System.Reflection; | 31 | using System.Reflection; |
31 | using System.Text; | 32 | using System.Text; |
33 | using System.Threading; | ||
32 | using System.Timers; | 34 | using System.Timers; |
33 | using log4net; | 35 | using log4net; |
34 | using OpenSim.Framework.Console; | 36 | using OpenSim.Framework.Console; |
@@ -47,7 +49,7 @@ namespace OpenSim.Framework.Servers | |||
47 | /// This will control a periodic log printout of the current 'show stats' (if they are active) for this | 49 | /// This will control a periodic log printout of the current 'show stats' (if they are active) for this |
48 | /// server. | 50 | /// server. |
49 | /// </summary> | 51 | /// </summary> |
50 | private Timer m_periodicDiagnosticsTimer = new Timer(60 * 60 * 1000); | 52 | private System.Timers.Timer m_periodicDiagnosticsTimer = new System.Timers.Timer(60 * 60 * 1000); |
51 | 53 | ||
52 | protected ConsoleBase m_console; | 54 | protected ConsoleBase m_console; |
53 | 55 | ||
@@ -154,6 +156,7 @@ namespace OpenSim.Framework.Servers | |||
154 | if (m_stats != null) | 156 | if (m_stats != null) |
155 | Notice("show stats - show statistical information for this server"); | 157 | Notice("show stats - show statistical information for this server"); |
156 | 158 | ||
159 | Notice("show threads - list tracked threads"); | ||
157 | Notice("show uptime - show server startup time and uptime."); | 160 | Notice("show uptime - show server startup time and uptime."); |
158 | Notice("show version - show server version."); | 161 | Notice("show version - show server version."); |
159 | Notice("shutdown - shutdown the server.\n"); | 162 | Notice("shutdown - shutdown the server.\n"); |
@@ -193,14 +196,36 @@ namespace OpenSim.Framework.Servers | |||
193 | Notice(m_stats.Report()); | 196 | Notice(m_stats.Report()); |
194 | } | 197 | } |
195 | break; | 198 | break; |
199 | |||
200 | case "threads": | ||
201 | // m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:"); | ||
202 | // int _tc = 0; | ||
203 | |||
204 | // foreach (ProcessThread pt in Process.GetCurrentProcess().Threads) | ||
205 | // { | ||
206 | // _tc++; | ||
207 | // m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString()); | ||
208 | // } | ||
209 | |||
210 | List<Thread> threads = ThreadTracker.GetThreads(); | ||
211 | if (threads == null) | ||
212 | { | ||
213 | Notice("Thread tracking is only enabled in DEBUG mode."); | ||
214 | } | ||
215 | else | ||
216 | { | ||
217 | int tc = 0; | ||
218 | Notice(threads.Count + " threads are being tracked:"); | ||
219 | foreach (Thread t in threads) | ||
220 | { | ||
221 | tc++; | ||
222 | Notice(tc + ": ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString()); | ||
223 | } | ||
224 | } | ||
225 | break; | ||
196 | 226 | ||
197 | case "uptime": | 227 | case "uptime": |
198 | Notice(GetUptimeReport()); | 228 | Notice(GetUptimeReport()); |
199 | /* | ||
200 | Notice("Time now is " + DateTime.Now); | ||
201 | Notice("Server has been running since " + m_startuptime.DayOfWeek + ", " + m_startuptime.ToString()); | ||
202 | Notice("That is an elapsed time of " + (DateTime.Now - m_startuptime).ToString()); | ||
203 | */ | ||
204 | break; | 229 | break; |
205 | 230 | ||
206 | case "version": | 231 | case "version": |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 4afe37b..0616812 100644 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -295,7 +295,6 @@ namespace OpenSim | |||
295 | m_console.Notice("show users - show info about connected users."); | 295 | m_console.Notice("show users - show info about connected users."); |
296 | m_console.Notice("show modules - shows info about loaded modules."); | 296 | m_console.Notice("show modules - shows info about loaded modules."); |
297 | m_console.Notice("show regions - show running region information."); | 297 | m_console.Notice("show regions - show running region information."); |
298 | m_console.Notice("threads - list threads"); | ||
299 | m_console.Notice("config set section field value - set a config value"); | 298 | m_console.Notice("config set section field value - set a config value"); |
300 | m_console.Notice("config get section field - get a config value"); | 299 | m_console.Notice("config get section field - get a config value"); |
301 | m_console.Notice("config save - save OpenSim.ini"); | 300 | m_console.Notice("config save - save OpenSim.ini"); |
@@ -303,33 +302,6 @@ namespace OpenSim | |||
303 | ShowPluginCommandsHelp(CombineParams(cmdparams, 0), m_console); | 302 | ShowPluginCommandsHelp(CombineParams(cmdparams, 0), m_console); |
304 | break; | 303 | break; |
305 | 304 | ||
306 | case "threads": | ||
307 | // m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:"); | ||
308 | // int _tc = 0; | ||
309 | |||
310 | // foreach (ProcessThread pt in Process.GetCurrentProcess().Threads) | ||
311 | // { | ||
312 | // _tc++; | ||
313 | // m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString()); | ||
314 | // } | ||
315 | |||
316 | List<Thread> threads = ThreadTracker.GetThreads(); | ||
317 | if (threads == null) | ||
318 | { | ||
319 | m_console.Notice("THREAD", "Thread tracking is only enabled in DEBUG mode."); | ||
320 | } | ||
321 | else | ||
322 | { | ||
323 | int _tc = 0; | ||
324 | m_console.Notice("THREAD", threads.Count + " threads are being tracked:"); | ||
325 | foreach (Thread t in threads) | ||
326 | { | ||
327 | _tc++; | ||
328 | m_console.Notice("THREAD", _tc + ": ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString()); | ||
329 | } | ||
330 | } | ||
331 | |||
332 | break; | ||
333 | case "save-xml": | 305 | case "save-xml": |
334 | 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."); | 306 | 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."); |
335 | 307 | ||