diff options
author | Tedd Hansen | 2008-02-21 10:43:24 +0000 |
---|---|---|
committer | Tedd Hansen | 2008-02-21 10:43:24 +0000 |
commit | 7102ac77698f4bfd7406d6e8871db7b006c2cae2 (patch) | |
tree | 7253775d1a6ae64e2469b1ef79863aaebe83e1d1 /OpenSim/Region | |
parent | Remove a couple compiler warnings. (diff) | |
download | opensim-SC_OLD-7102ac77698f4bfd7406d6e8871db7b006c2cae2.zip opensim-SC_OLD-7102ac77698f4bfd7406d6e8871db7b006c2cae2.tar.gz opensim-SC_OLD-7102ac77698f4bfd7406d6e8871db7b006c2cae2.tar.bz2 opensim-SC_OLD-7102ac77698f4bfd7406d6e8871db7b006c2cae2.tar.xz |
"threads" command now works. I've added manual tracking of threads (only if compiled in DEBUG mode)... Its ugly and even requires a separate thread to track the treads, but it will be very valuable in debugging.
Diffstat (limited to 'OpenSim/Region')
10 files changed, 38 insertions, 7 deletions
diff --git a/OpenSim/Region/Application/OpenSimMain.cs b/OpenSim/Region/Application/OpenSimMain.cs index fc739d9..59f7c63 100644 --- a/OpenSim/Region/Application/OpenSimMain.cs +++ b/OpenSim/Region/Application/OpenSimMain.cs | |||
@@ -754,15 +754,30 @@ namespace OpenSim | |||
754 | break; | 754 | break; |
755 | 755 | ||
756 | case "threads": | 756 | case "threads": |
757 | m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:"); | 757 | //m_console.Notice("THREAD", Process.GetCurrentProcess().Threads.Count + " threads running:"); |
758 | int _tc = 0; | 758 | //int _tc = 0; |
759 | 759 | ||
760 | foreach (ProcessThread pt in Process.GetCurrentProcess().Threads) | 760 | //foreach (ProcessThread pt in Process.GetCurrentProcess().Threads) |
761 | //{ | ||
762 | // _tc++; | ||
763 | // m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString()); | ||
764 | |||
765 | //} | ||
766 | List<Thread> threads = OpenSim.Framework.ThreadTracker.GetThreads(); | ||
767 | if (threads == null) | ||
768 | { | ||
769 | m_console.Notice("THREAD", "Thread tracking is only enabled in DEBUG mode."); | ||
770 | } | ||
771 | else | ||
772 | { | ||
773 | int _tc = 0; | ||
774 | m_console.Notice("THREAD", threads.Count + " threads are being tracked:"); | ||
775 | foreach (Thread t in threads) | ||
761 | { | 776 | { |
762 | _tc++; | 777 | _tc++; |
763 | m_console.Notice("THREAD", _tc + ": ID: " + pt.Id + ", Started: " + pt.StartTime.ToString() + ", CPU time: " + pt.TotalProcessorTime + ", Pri: " + pt.BasePriority.ToString() + ", State: " + pt.ThreadState.ToString()); | 778 | m_console.Notice("THREAD", _tc + ": ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString()); |
764 | |||
765 | } | 779 | } |
780 | } | ||
766 | 781 | ||
767 | 782 | ||
768 | break; | 783 | break; |
diff --git a/OpenSim/Region/ClientStack/ClientView.cs b/OpenSim/Region/ClientStack/ClientView.cs index 47cb582..848a08d 100644 --- a/OpenSim/Region/ClientStack/ClientView.cs +++ b/OpenSim/Region/ClientStack/ClientView.cs | |||
@@ -228,6 +228,7 @@ namespace OpenSim.Region.ClientStack | |||
228 | m_clientThread.Name = "ClientThread"; | 228 | m_clientThread.Name = "ClientThread"; |
229 | m_clientThread.IsBackground = true; | 229 | m_clientThread.IsBackground = true; |
230 | m_clientThread.Start(); | 230 | m_clientThread.Start(); |
231 | OpenSim.Framework.ThreadTracker.Add(m_clientThread); | ||
231 | } | 232 | } |
232 | 233 | ||
233 | public void SetDebug(int newDebug) | 234 | public void SetDebug(int newDebug) |
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs index 0510ad6..c146941 100644 --- a/OpenSim/Region/Environment/Modules/ChatModule.cs +++ b/OpenSim/Region/Environment/Modules/ChatModule.cs | |||
@@ -113,7 +113,10 @@ namespace OpenSim.Region.Environment.Modules | |||
113 | m_irc_connector.Name = "IRCConnectorThread"; | 113 | m_irc_connector.Name = "IRCConnectorThread"; |
114 | m_irc_connector.IsBackground = true; | 114 | m_irc_connector.IsBackground = true; |
115 | } | 115 | } |
116 | if (!m_irc_connector.IsAlive) { m_irc_connector.Start(); } | 116 | if (!m_irc_connector.IsAlive) { |
117 | m_irc_connector.Start(); | ||
118 | OpenSim.Framework.ThreadTracker.Add(m_irc_connector); | ||
119 | } | ||
117 | } | 120 | } |
118 | catch (Exception ex) | 121 | catch (Exception ex) |
119 | { | 122 | { |
@@ -260,7 +263,10 @@ namespace OpenSim.Region.Environment.Modules | |||
260 | m_irc_connector.Name = "IRCConnectorThread"; | 263 | m_irc_connector.Name = "IRCConnectorThread"; |
261 | m_irc_connector.IsBackground = true; | 264 | m_irc_connector.IsBackground = true; |
262 | } | 265 | } |
263 | if (!m_irc_connector.IsAlive) { m_irc_connector.Start(); } | 266 | if (!m_irc_connector.IsAlive) { |
267 | m_irc_connector.Start(); | ||
268 | OpenSim.Framework.ThreadTracker.Add(m_irc_connector); | ||
269 | } | ||
264 | } | 270 | } |
265 | catch (Exception ex) | 271 | catch (Exception ex) |
266 | { | 272 | { |
@@ -421,11 +427,13 @@ namespace OpenSim.Region.Environment.Modules | |||
421 | pingSender.Name = "PingSenderThread"; | 427 | pingSender.Name = "PingSenderThread"; |
422 | pingSender.IsBackground = true; | 428 | pingSender.IsBackground = true; |
423 | pingSender.Start(); | 429 | pingSender.Start(); |
430 | OpenSim.Framework.ThreadTracker.Add(pingSender); | ||
424 | 431 | ||
425 | listener = new Thread(new ThreadStart(ListenerRun)); | 432 | listener = new Thread(new ThreadStart(ListenerRun)); |
426 | listener.Name = "IRCChatModuleListenerThread"; | 433 | listener.Name = "IRCChatModuleListenerThread"; |
427 | listener.IsBackground = true; | 434 | listener.IsBackground = true; |
428 | listener.Start(); | 435 | listener.Start(); |
436 | OpenSim.Framework.ThreadTracker.Add(listener); | ||
429 | 437 | ||
430 | m_writer.WriteLine(m_user); | 438 | m_writer.WriteLine(m_user); |
431 | m_writer.Flush(); | 439 | m_writer.Flush(); |
diff --git a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs index 47dd250..54a3bc0 100644 --- a/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs +++ b/OpenSim/Region/Environment/Modules/ScriptsHttpRequests.cs | |||
@@ -287,6 +287,7 @@ namespace OpenSim.Region.Environment.Modules | |||
287 | httpThread.IsBackground = true; | 287 | httpThread.IsBackground = true; |
288 | finished = false; | 288 | finished = false; |
289 | httpThread.Start(); | 289 | httpThread.Start(); |
290 | OpenSim.Framework.ThreadTracker.Add(httpThread); | ||
290 | } | 291 | } |
291 | 292 | ||
292 | /* | 293 | /* |
diff --git a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs index ecf44a6..c773f9e 100644 --- a/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs +++ b/OpenSim/Region/Environment/Modules/TextureDownloadModule.cs | |||
@@ -75,6 +75,7 @@ namespace OpenSim.Region.Environment.Modules | |||
75 | m_thread.Name = "ProcessTextureSenderThread"; | 75 | m_thread.Name = "ProcessTextureSenderThread"; |
76 | m_thread.IsBackground = true; | 76 | m_thread.IsBackground = true; |
77 | m_thread.Start(); | 77 | m_thread.Start(); |
78 | OpenSim.Framework.ThreadTracker.Add(m_thread); | ||
78 | } | 79 | } |
79 | 80 | ||
80 | if (!m_scenes.Contains(scene)) | 81 | if (!m_scenes.Contains(scene)) |
diff --git a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs index 3cdb576..6294a49 100644 --- a/OpenSim/Region/Environment/Modules/XMLRPCModule.cs +++ b/OpenSim/Region/Environment/Modules/XMLRPCModule.cs | |||
@@ -584,6 +584,7 @@ namespace OpenSim.Region.Environment.Modules | |||
584 | httpThread.IsBackground = true; | 584 | httpThread.IsBackground = true; |
585 | finished = false; | 585 | finished = false; |
586 | httpThread.Start(); | 586 | httpThread.Start(); |
587 | OpenSim.Framework.ThreadTracker.Add(httpThread); | ||
587 | 588 | ||
588 | return reqID; | 589 | return reqID; |
589 | 590 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs index 222b8f2..81e3438 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/AsyncLSLCommandManager.cs | |||
@@ -57,6 +57,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
57 | cmdHandlerThread.Priority = ThreadPriority.BelowNormal; | 57 | cmdHandlerThread.Priority = ThreadPriority.BelowNormal; |
58 | cmdHandlerThread.IsBackground = true; | 58 | cmdHandlerThread.IsBackground = true; |
59 | cmdHandlerThread.Start(); | 59 | cmdHandlerThread.Start(); |
60 | OpenSim.Framework.ThreadTracker.Add(cmdHandlerThread); | ||
60 | } | 61 | } |
61 | 62 | ||
62 | public void ReadConfig() | 63 | public void ReadConfig() |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs index d4db935..6f96654 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/EventQueueThreadClass.cs | |||
@@ -117,6 +117,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
117 | EventQueueThread.Priority = MyThreadPriority; | 117 | EventQueueThread.Priority = MyThreadPriority; |
118 | EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount; | 118 | EventQueueThread.Name = "EventQueueManagerThread_" + ThreadCount; |
119 | EventQueueThread.Start(); | 119 | EventQueueThread.Start(); |
120 | OpenSim.Framework.ThreadTracker.Add(EventQueueThread); | ||
120 | 121 | ||
121 | // Look at this... Don't you wish everyone did that solid coding everywhere? :P | 122 | // Look at this... Don't you wish everyone did that solid coding everywhere? :P |
122 | if (ThreadCount == int.MaxValue) | 123 | if (ThreadCount == int.MaxValue) |
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs index 47446a3..4776ffe 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/MaintenanceThread.cs | |||
@@ -78,6 +78,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
78 | MaintenanceThreadThread.Name = "ScriptMaintenanceThread"; | 78 | MaintenanceThreadThread.Name = "ScriptMaintenanceThread"; |
79 | MaintenanceThreadThread.IsBackground = true; | 79 | MaintenanceThreadThread.IsBackground = true; |
80 | MaintenanceThreadThread.Start(); | 80 | MaintenanceThreadThread.Start(); |
81 | OpenSim.Framework.ThreadTracker.Add(MaintenanceThreadThread); | ||
81 | } | 82 | } |
82 | } | 83 | } |
83 | 84 | ||
diff --git a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs index 43ff4ac..684d133 100644 --- a/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs +++ b/OpenSim/Region/ScriptEngine/Common/ScriptEngineBase/ScriptManager.cs | |||
@@ -160,6 +160,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase | |||
160 | t.IsBackground = true; | 160 | t.IsBackground = true; |
161 | t.Priority = ThreadPriority.Normal; | 161 | t.Priority = ThreadPriority.Normal; |
162 | t.Start(); | 162 | t.Start(); |
163 | OpenSim.Framework.ThreadTracker.Add(t); | ||
163 | return t; | 164 | return t; |
164 | } | 165 | } |
165 | 166 | ||