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/Framework/Servers/BaseOpenSimServer.cs | |
parent | * Put an info entry in the log if permissions are being bypassed (diff) | |
download | opensim-SC_OLD-f7d9b0bab710693417fa653e3dcf26374c93d100.zip opensim-SC_OLD-f7d9b0bab710693417fa653e3dcf26374c93d100.tar.gz opensim-SC_OLD-f7d9b0bab710693417fa653e3dcf26374c93d100.tar.bz2 opensim-SC_OLD-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/Framework/Servers/BaseOpenSimServer.cs')
-rw-r--r-- | OpenSim/Framework/Servers/BaseOpenSimServer.cs | 37 |
1 files changed, 31 insertions, 6 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": |