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.
parent
2d3072f053
commit
af286d5fcb
|
@ -87,7 +87,7 @@ namespace OpenSim.Framework.Monitoring
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Stat Stat { get; set; }
|
public Stat Stat { get; set; }
|
||||||
|
|
||||||
public ThreadWatchdogInfo(Thread thread, int timeout)
|
public ThreadWatchdogInfo(Thread thread, int timeout, string name)
|
||||||
{
|
{
|
||||||
Thread = thread;
|
Thread = thread;
|
||||||
Timeout = timeout;
|
Timeout = timeout;
|
||||||
|
@ -96,8 +96,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
|
|
||||||
Stat
|
Stat
|
||||||
= new Stat(
|
= new Stat(
|
||||||
thread.Name,
|
name,
|
||||||
string.Format("Last update of thread {0}", thread.Name),
|
string.Format("Last update of thread {0}", name),
|
||||||
"",
|
"",
|
||||||
"ms",
|
"ms",
|
||||||
"server",
|
"server",
|
||||||
|
@ -216,12 +216,11 @@ namespace OpenSim.Framework.Monitoring
|
||||||
bool alarmIfTimeout, Func<string> alarmMethod, int timeout, bool log = true)
|
bool alarmIfTimeout, Func<string> alarmMethod, int timeout, bool log = true)
|
||||||
{
|
{
|
||||||
Thread thread = new Thread(start);
|
Thread thread = new Thread(start);
|
||||||
thread.Name = name;
|
|
||||||
thread.Priority = priority;
|
thread.Priority = priority;
|
||||||
thread.IsBackground = isBackground;
|
thread.IsBackground = isBackground;
|
||||||
|
|
||||||
ThreadWatchdogInfo twi
|
ThreadWatchdogInfo twi
|
||||||
= new ThreadWatchdogInfo(thread, timeout)
|
= new ThreadWatchdogInfo(thread, timeout, name)
|
||||||
{ AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod };
|
{ AlarmIfTimeout = alarmIfTimeout, AlarmMethod = alarmMethod };
|
||||||
|
|
||||||
if (log)
|
if (log)
|
||||||
|
@ -232,6 +231,8 @@ namespace OpenSim.Framework.Monitoring
|
||||||
m_threads.Add(twi.Thread.ManagedThreadId, twi);
|
m_threads.Add(twi.Thread.ManagedThreadId, twi);
|
||||||
|
|
||||||
thread.Start();
|
thread.Start();
|
||||||
|
thread.Name = name;
|
||||||
|
|
||||||
|
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,9 +70,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
_id = id;
|
_id = id;
|
||||||
|
|
||||||
_engine = new Thread(new ThreadStart(Engine));
|
_engine = new Thread(new ThreadStart(Engine));
|
||||||
_engine.Name = EngineID;
|
|
||||||
_engine.IsBackground = true;
|
_engine.IsBackground = true;
|
||||||
_engine.Start();
|
_engine.Start();
|
||||||
|
_engine.Name = string.Format ("Engine:{0}",EngineID);
|
||||||
|
|
||||||
ThreadTracker.Add(_engine);
|
ThreadTracker.Add(_engine);
|
||||||
}
|
}
|
||||||
|
@ -91,9 +91,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
_engine = new Thread(new ThreadStart(Engine));
|
_engine = new Thread(new ThreadStart(Engine));
|
||||||
_engine.Name = EngineID;
|
|
||||||
_engine.IsBackground = true;
|
_engine.IsBackground = true;
|
||||||
_engine.Start();
|
_engine.Start();
|
||||||
|
_engine.Name = string.Format ("Engine:{0}",EngineID);
|
||||||
|
|
||||||
ThreadTracker.Add(_engine);
|
ThreadTracker.Add(_engine);
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,9 +150,9 @@ namespace OpenSim.Framework.Servers.HttpServer
|
||||||
public void Start()
|
public void Start()
|
||||||
{
|
{
|
||||||
_engine = new Thread(new ThreadStart(Engine));
|
_engine = new Thread(new ThreadStart(Engine));
|
||||||
_engine.Name = _engineId;
|
|
||||||
_engine.IsBackground = true;
|
_engine.IsBackground = true;
|
||||||
_engine.Start();
|
_engine.Start();
|
||||||
|
_engine.Name = string.Format ("Engine:{0}",_engineId);
|
||||||
|
|
||||||
ThreadTracker.Add(_engine);
|
ThreadTracker.Add(_engine);
|
||||||
|
|
||||||
|
|
|
@ -1079,6 +1079,8 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
StatsReporter = new SimStatsReporter(this);
|
StatsReporter = new SimStatsReporter(this);
|
||||||
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
StatsReporter.OnSendStatsResult += SendSimStatsPackets;
|
||||||
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
StatsReporter.OnStatsIncorrect += m_sceneGraph.RecalculateStats;
|
||||||
|
|
||||||
|
Thread.CurrentThread.Name = string.Format ("Scene:{0}", regInfo.RegionName.Replace(" ", "_"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo)
|
public Scene(RegionInfo regInfo, PhysicsScene physicsScene) : base(regInfo)
|
||||||
|
@ -1396,7 +1398,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
m_heartbeatThread
|
m_heartbeatThread
|
||||||
= Watchdog.StartThread(
|
= Watchdog.StartThread(
|
||||||
Heartbeat, string.Format("Heartbeat ({0})", RegionInfo.RegionName), ThreadPriority.Normal, false, false);
|
Heartbeat, string.Format("Heartbeat-({0})", RegionInfo.RegionName.Replace(" ", "_")), ThreadPriority.Normal, false, false);
|
||||||
|
|
||||||
StartScripts();
|
StartScripts();
|
||||||
}
|
}
|
||||||
|
|
|
@ -677,7 +677,6 @@ namespace Amib.Threading
|
||||||
: new Thread(ProcessQueuedItems);
|
: new Thread(ProcessQueuedItems);
|
||||||
#endif
|
#endif
|
||||||
// Configure the new thread and start it
|
// Configure the new thread and start it
|
||||||
workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
|
|
||||||
workerThread.IsBackground = _stpStartInfo.AreThreadsBackground;
|
workerThread.IsBackground = _stpStartInfo.AreThreadsBackground;
|
||||||
|
|
||||||
#if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE)
|
#if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE)
|
||||||
|
@ -691,6 +690,7 @@ namespace Amib.Threading
|
||||||
workerThread.Priority = _stpStartInfo.ThreadPriority;
|
workerThread.Priority = _stpStartInfo.ThreadPriority;
|
||||||
#endif
|
#endif
|
||||||
workerThread.Start();
|
workerThread.Start();
|
||||||
|
workerThread.Name = string.Format("STP:{0}:{1}", Name, _threadCounter);
|
||||||
++_threadCounter;
|
++_threadCounter;
|
||||||
|
|
||||||
// Add it to the dictionary and update its creation time.
|
// Add it to the dictionary and update its creation time.
|
||||||
|
|
Loading…
Reference in New Issue