aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers
diff options
context:
space:
mode:
authorJustin Clarke Casey2008-08-25 23:21:07 +0000
committerJustin Clarke Casey2008-08-25 23:21:07 +0000
commit4a475ca2be259cf3e31b29148f04f325b304a6c5 (patch)
tree35e658b5819d14ad4e33a283d5e69ef2c9f56c31 /OpenSim/Framework/Servers
parent* Added Zha to Contributors for OGP patch. (diff)
downloadopensim-SC_OLD-4a475ca2be259cf3e31b29148f04f325b304a6c5.zip
opensim-SC_OLD-4a475ca2be259cf3e31b29148f04f325b304a6c5.tar.gz
opensim-SC_OLD-4a475ca2be259cf3e31b29148f04f325b304a6c5.tar.bz2
opensim-SC_OLD-4a475ca2be259cf3e31b29148f04f325b304a6c5.tar.xz
* minor: refactor thread report into a method that returns a string rather than displays information directly
Diffstat (limited to 'OpenSim/Framework/Servers')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs44
1 files changed, 29 insertions, 15 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index 29ee143..ea3eed1 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -110,6 +110,32 @@ namespace OpenSim.Framework.Servers
110 110
111 m_log.Debug(sb); 111 m_log.Debug(sb);
112 } 112 }
113
114 /// <summary>
115 /// Get a report about the registered threads in this server.
116 /// </summary>
117 protected string GetThreadReport()
118 {
119 StringBuilder sb = new StringBuilder();
120
121 List<Thread> threads = ThreadTracker.GetThreads();
122 if (threads == null)
123 {
124 sb.Append("Thread tracking is only enabled in DEBUG mode.");
125 }
126 else
127 {
128 sb.Append(threads.Count + " threads are being tracked:" + Environment.NewLine);
129 foreach (Thread t in threads)
130 {
131 sb.Append(
132 "ID: " + t.ManagedThreadId + ", Name: " + t.Name + ", Alive: " + t.IsAlive
133 + ", Pri: " + t.Priority + ", State: " + t.ThreadState + Environment.NewLine);
134 }
135 }
136
137 return sb.ToString();
138 }
113 139
114 /// <summary> 140 /// <summary>
115 /// Return a report about the uptime of this server 141 /// Return a report about the uptime of this server
@@ -261,7 +287,7 @@ namespace OpenSim.Framework.Servers
261 /// Show help information 287 /// Show help information
262 /// </summary> 288 /// </summary>
263 /// <param name="helpArgs"></param> 289 /// <param name="helpArgs"></param>
264 public virtual void ShowHelp(string[] helpArgs) 290 protected virtual void ShowHelp(string[] helpArgs)
265 { 291 {
266 if (helpArgs.Length == 0) 292 if (helpArgs.Length == 0)
267 { 293 {
@@ -283,7 +309,7 @@ namespace OpenSim.Framework.Servers
283 309
284 return; 310 return;
285 } 311 }
286 } 312 }
287 313
288 /// <summary> 314 /// <summary>
289 /// Outputs to the console information about the region 315 /// Outputs to the console information about the region
@@ -308,19 +334,7 @@ namespace OpenSim.Framework.Servers
308 break; 334 break;
309 335
310 case "threads": 336 case "threads":
311 List<Thread> threads = ThreadTracker.GetThreads(); 337 Notice(GetThreadReport());
312 if (threads == null)
313 {
314 Notice("Thread tracking is only enabled in DEBUG mode.");
315 }
316 else
317 {
318 Notice(threads.Count + " threads are being tracked:");
319 foreach (Thread t in threads)
320 {
321 Notice("ID: " + t.ManagedThreadId.ToString() + ", Name: " + t.Name + ", Alive: " + t.IsAlive.ToString() + ", Pri: " + t.Priority.ToString() + ", State: " + t.ThreadState.ToString());
322 }
323 }
324 break; 338 break;
325 339
326 case "uptime": 340 case "uptime":