aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorBlueWall2014-09-17 17:56:10 -0400
committerBlueWall2014-09-17 17:56:10 -0400
commitaf286d5fcb688e8b64202b6deca4f249e9a2b6b8 (patch)
tree438067d64a71dcf663c2090f3f0b837fb8661e19
parentWhen osNpcMoveToTarget() is called for a sitting avatar then silently do noth... (diff)
downloadopensim-SC_OLD-af286d5fcb688e8b64202b6deca4f249e9a2b6b8.zip
opensim-SC_OLD-af286d5fcb688e8b64202b6deca4f249e9a2b6b8.tar.gz
opensim-SC_OLD-af286d5fcb688e8b64202b6deca4f249e9a2b6b8.tar.bz2
opensim-SC_OLD-af286d5fcb688e8b64202b6deca4f249e9a2b6b8.tar.xz
Small changes to threading to send thread names to unmanaged threads. Needs Mono 3.6+ to see thread names in utilities like top -H . Some formatting of the thread name to fin in the 16 byte limit on Linux. Please test on Windows to see if the work has any adverse effects.
-rw-r--r--OpenSim/Framework/Monitoring/Watchdog.cs13
-rw-r--r--OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs4
-rw-r--r--OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/Scene.cs4
-rw-r--r--ThirdParty/SmartThreadPool/SmartThreadPool.cs2
5 files changed, 14 insertions, 11 deletions
diff --git a/OpenSim/Framework/Monitoring/Watchdog.cs b/OpenSim/Framework/Monitoring/Watchdog.cs
index e9e7bd2..e9f22f1 100644
--- a/OpenSim/Framework/Monitoring/Watchdog.cs
+++ b/OpenSim/Framework/Monitoring/Watchdog.cs
@@ -87,7 +87,7 @@ namespace OpenSim.Framework.Monitoring
87 /// </summary> 87 /// </summary>
88 public Stat Stat { get; set; } 88 public Stat Stat { get; set; }
89 89
90 public ThreadWatchdogInfo(Thread thread, int timeout) 90 public ThreadWatchdogInfo(Thread thread, int timeout, string name)
91 { 91 {
92 Thread = thread; 92 Thread = thread;
93 Timeout = timeout; 93 Timeout = timeout;
@@ -96,8 +96,8 @@ namespace OpenSim.Framework.Monitoring
96 96
97 Stat 97 Stat
98 = new Stat( 98 = new Stat(
99 thread.Name, 99 name,
100 string.Format("Last update of thread {0}", thread.Name), 100 string.Format("Last update of thread {0}", name),
101 "", 101 "",
102 "ms", 102 "ms",
103 "server", 103 "server",
@@ -216,12 +216,11 @@ namespace OpenSim.Framework.Monitoring
216 bool alarmIfTimeout, Func<string> alarmMethod, int timeout, bool log = true) 216 bool alarmIfTimeout, Func<string> alarmMethod, int timeout, bool log = true)
217 { 217 {
218 Thread thread = new Thread(start); 218 Thread thread = new Thread(start);
219 thread.Name = name;
220 thread.Priority = priority; 219 thread.Priority = priority;
221 thread.IsBackground = isBackground; 220 thread.IsBackground = isBackground;
222 221
223 ThreadWatchdogInfo twi 222 ThreadWatchdogInfo twi
224 = new ThreadWatchdogInfo(thread, timeout) 223 = new ThreadWatchdogInfo(thread, timeout, name)
225 { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod }; 224 { AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod };
226 225
227 if (log) 226 if (log)
@@ -230,8 +229,10 @@ namespace OpenSim.Framework.Monitoring
230 229
231 lock (m_threads) 230 lock (m_threads)
232 m_threads.Add(twi.Thread.ManagedThreadId, twi); 231 m_threads.Add(twi.Thread.ManagedThreadId, twi);
233 232
234 thread.Start(); 233 thread.Start();
234 thread.Name = name;
235
235 236
236 return thread; 237 return thread;
237 } 238 }
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs
index 77cfb7e..bdea278 100644
--- a/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs
+++ b/OpenSim/Framework/Servers/HttpServer/OSHttpRequestPump.cs
@@ -70,9 +70,9 @@ namespace OpenSim.Framework.Servers.HttpServer
70 _id = id; 70 _id = id;
71 71
72 _engine = new Thread(new ThreadStart(Engine)); 72 _engine = new Thread(new ThreadStart(Engine));
73 _engine.Name = EngineID;
74 _engine.IsBackground = true; 73 _engine.IsBackground = true;
75 _engine.Start(); 74 _engine.Start();
75 _engine.Name = string.Format ("Engine:{0}",EngineID);
76 76
77 ThreadTracker.Add(_engine); 77 ThreadTracker.Add(_engine);
78 } 78 }
@@ -91,9 +91,9 @@ namespace OpenSim.Framework.Servers.HttpServer
91 public void Start() 91 public void Start()
92 { 92 {
93 _engine = new Thread(new ThreadStart(Engine)); 93 _engine = new Thread(new ThreadStart(Engine));
94 _engine.Name = EngineID;
95 _engine.IsBackground = true; 94 _engine.IsBackground = true;
96 _engine.Start(); 95 _engine.Start();
96 _engine.Name = string.Format ("Engine:{0}",EngineID);
97 97
98 ThreadTracker.Add(_engine); 98 ThreadTracker.Add(_engine);
99 } 99 }
diff --git a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs
index 84aa31b..cd62842 100644
--- a/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs
+++ b/OpenSim/Framework/Servers/HttpServer/OSHttpServer.cs
@@ -150,9 +150,9 @@ namespace OpenSim.Framework.Servers.HttpServer
150 public void Start() 150 public void Start()
151 { 151 {
152 _engine = new Thread(new ThreadStart(Engine)); 152 _engine = new Thread(new ThreadStart(Engine));
153 _engine.Name = _engineId;
154 _engine.IsBackground = true; 153 _engine.IsBackground = true;
155 _engine.Start(); 154 _engine.Start();
155 _engine.Name = string.Format ("Engine:{0}",_engineId);
156 156
157 ThreadTracker.Add(_engine); 157 ThreadTracker.Add(_engine);
158 158
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs
index 28dbccb..7e4d9ed 100644
--- a/OpenSim/Region/Framework/Scenes/Scene.cs
+++ b/OpenSim/Region/Framework/Scenes/Scene.cs
@@ -1079,6 +1079,8 @@ namespace OpenSim.Region.Framework.Scenes
1079 StatsReporter = new SimStatsReporter(this); 1079 StatsReporter = new SimStatsReporter(this);
1080 StatsReporter.OnSendStatsResult += SendSimStatsPackets; 1080 StatsReporter.OnSendStatsResult += SendSimStatsPackets;
1081 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats; 1081 StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
1082
1083 Thread.CurrentThread.Name = string.Format ("Scene:{0}", regInfo.RegionName.Replace(" ", "_"));
1082 } 1084 }
1083 1085
1084 public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo) 1086 public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo)
@@ -1396,7 +1398,7 @@ namespace OpenSim.Region.Framework.Scenes
1396 1398
1397 m_heartbeatThread 1399 m_heartbeatThread
1398 = Watchdog.StartThread( 1400 = Watchdog.StartThread(
1399 Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false); 1401 Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false);
1400 1402
1401 StartScripts(); 1403 StartScripts();
1402 } 1404 }
diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
index a4f4ce5..615518e 100644
--- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs
+++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
@@ -677,7 +677,6 @@ namespace Amib.Threading
677 : new Thread(ProcessQueuedItems); 677 : new Thread(ProcessQueuedItems);
678#endif 678#endif
679 // Configure the new thread and start it 679 // Configure the new thread and start it
680 workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
681 workerThread.IsBackground = _stpStartInfo.AreThreadsBackground; 680 workerThread.IsBackground = _stpStartInfo.AreThreadsBackground;
682 681
683#if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE) 682#if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE)
@@ -691,6 +690,7 @@ namespace Amib.Threading
691 workerThread.Priority = _stpStartInfo.ThreadPriority; 690 workerThread.Priority = _stpStartInfo.ThreadPriority;
692#endif 691#endif
693 workerThread.Start(); 692 workerThread.Start();
693 workerThread.Name = string.Format("STP:{0}:{1}", Name, _threadCounter);
694 ++_threadCounter; 694 ++_threadCounter;
695 695
696 // Add it to the dictionary and update its creation time. 696 // Add it to the dictionary and update its creation time.