aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs78
1 files changed, 78 insertions, 0 deletions
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index a8e0f81..55b6c58 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -256,6 +256,12 @@ namespace OpenSim.Framework.Servers
256 "Show thread status. Synonym for \"show threads\"", 256 "Show thread status. Synonym for \"show threads\"",
257 (string module, string[] args) => Notice(GetThreadsReport())); 257 (string module, string[] args) => Notice(GetThreadsReport()));
258 258
259 m_console.Commands.AddCommand (
260 "Debug", false, "debug threadpool set",
261 "debug threadpool set worker|iocp min|max <n>",
262 "Set threadpool parameters. For debug purposes.",
263 HandleDebugThreadpoolSet);
264
259 m_console.Commands.AddCommand( 265 m_console.Commands.AddCommand(
260 "General", false, "force gc", 266 "General", false, "force gc",
261 "force gc", 267 "force gc",
@@ -283,6 +289,78 @@ namespace OpenSim.Framework.Servers
283 m_serverStatsCollector.Start(); 289 m_serverStatsCollector.Start();
284 } 290 }
285 291
292 private void HandleDebugThreadpoolSet(string module, string[] args)
293 {
294 if (args.Length != 6)
295 {
296 Notice("Usage: debug threadpool set worker|iocp min|max <n>");
297 return;
298 }
299
300 int newThreads;
301
302 if (!ConsoleUtil.TryParseConsoleInt(m_console, args[5], out newThreads))
303 return;
304
305 string poolType = args[3];
306 string bound = args[4];
307
308 bool fail = false;
309 int workerThreads, iocpThreads;
310
311 if (poolType == "worker")
312 {
313 if (bound == "min")
314 {
315 ThreadPool.GetMinThreads(out workerThreads, out iocpThreads);
316
317 if (!ThreadPool.SetMinThreads(newThreads, iocpThreads))
318 fail = true;
319 }
320 else
321 {
322 ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
323
324 if (!ThreadPool.SetMaxThreads(newThreads, iocpThreads))
325 fail = true;
326 }
327 }
328 else
329 {
330 if (bound == "min")
331 {
332 ThreadPool.GetMinThreads(out workerThreads, out iocpThreads);
333
334 if (!ThreadPool.SetMinThreads(workerThreads, newThreads))
335 fail = true;
336 }
337 else
338 {
339 ThreadPool.GetMaxThreads(out workerThreads, out iocpThreads);
340
341 if (!ThreadPool.SetMaxThreads(workerThreads, newThreads))
342 fail = true;
343 }
344 }
345
346 if (fail)
347 {
348 Notice("ERROR: Could not set {0} {1} threads to {2}", poolType, bound, newThreads);
349 }
350 else
351 {
352 int minWorkerThreads, maxWorkerThreads, minIocpThreads, maxIocpThreads;
353
354 ThreadPool.GetMinThreads(out minWorkerThreads, out minIocpThreads);
355 ThreadPool.GetMaxThreads(out maxWorkerThreads, out maxIocpThreads);
356
357 Notice("Min worker threads now {0}", minWorkerThreads);
358 Notice("Min IOCP threads now {0}", minIocpThreads);
359 Notice("Max worker threads now {0}", maxWorkerThreads);
360 Notice("Max IOCP threads now {0}", maxIocpThreads);
361 }
362 }
363
286 private void HandleForceGc(string module, string[] args) 364 private void HandleForceGc(string module, string[] args)
287 { 365 {
288 Notice("Manually invoking runtime garbage collection"); 366 Notice("Manually invoking runtime garbage collection");