aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Servers/ServerBase.cs
diff options
context:
space:
mode:
authorUbitUmarov2017-06-19 03:20:40 +0100
committerUbitUmarov2017-06-19 03:20:40 +0100
commit3fc6f62c4560df6b6d42bd43f060e60aecd2e26d (patch)
tree8087b365ef1e94bf276edf24600643ad395aa55e /OpenSim/Framework/Servers/ServerBase.cs
parentMerge branch 'master' into httptests (diff)
parent a defual can me comented out (diff)
downloadopensim-SC-3fc6f62c4560df6b6d42bd43f060e60aecd2e26d.zip
opensim-SC-3fc6f62c4560df6b6d42bd43f060e60aecd2e26d.tar.gz
opensim-SC-3fc6f62c4560df6b6d42bd43f060e60aecd2e26d.tar.bz2
opensim-SC-3fc6f62c4560df6b6d42bd43f060e60aecd2e26d.tar.xz
Merge branch 'master' into httptests
Diffstat (limited to 'OpenSim/Framework/Servers/ServerBase.cs')
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs61
1 files changed, 38 insertions, 23 deletions
diff --git a/OpenSim/Framework/Servers/ServerBase.cs b/OpenSim/Framework/Servers/ServerBase.cs
index 3bb2313..3c2dce8 100644
--- a/OpenSim/Framework/Servers/ServerBase.cs
+++ b/OpenSim/Framework/Servers/ServerBase.cs
@@ -882,16 +882,12 @@ namespace OpenSim.Framework.Servers
882 sb.Append("\n"); 882 sb.Append("\n");
883 } 883 }
884 884
885 sb.Append("\n"); 885 sb.Append(GetThreadPoolReport());
886 886
887 // For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting 887 sb.Append("\n");
888 // zero active threads.
889 int totalThreads = Process.GetCurrentProcess().Threads.Count; 888 int totalThreads = Process.GetCurrentProcess().Threads.Count;
890 if (totalThreads > 0) 889 if (totalThreads > 0)
891 sb.AppendFormat("Total threads active: {0}\n\n", totalThreads); 890 sb.AppendFormat("Total process threads active: {0}\n\n", totalThreads);
892
893 sb.Append("Main threadpool (excluding script engine pools)\n");
894 sb.Append(GetThreadPoolReport());
895 891
896 return sb.ToString(); 892 return sb.ToString();
897 } 893 }
@@ -902,15 +898,46 @@ namespace OpenSim.Framework.Servers
902 /// <returns></returns> 898 /// <returns></returns>
903 public static string GetThreadPoolReport() 899 public static string GetThreadPoolReport()
904 { 900 {
901
902 StringBuilder sb = new StringBuilder();
903
904 // framework pool is alwasy active
905 int maxWorkers;
906 int minWorkers;
907 int curWorkers;
908 int maxComp;
909 int minComp;
910 int curComp;
911
912 try
913 {
914 ThreadPool.GetMaxThreads(out maxWorkers, out maxComp);
915 ThreadPool.GetMinThreads(out minWorkers, out minComp);
916 ThreadPool.GetAvailableThreads(out curWorkers, out curComp);
917 curWorkers = maxWorkers - curWorkers;
918 curComp = maxComp - curComp;
919
920 sb.Append("\nFramework main threadpool \n");
921 sb.AppendFormat("workers: {0} ({1} / {2})\n", curWorkers, maxWorkers, minWorkers);
922 sb.AppendFormat("Completion: {0} ({1} / {2})\n", curComp, maxComp, minComp);
923 }
924 catch { }
925
926 if (
927 Util.FireAndForgetMethod == FireAndForgetMethod.QueueUserWorkItem
928 || Util.FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem)
929 {
930 sb.AppendFormat("\nThread pool used: Framework main threadpool\n");
931 return sb.ToString();
932 }
933
905 string threadPoolUsed = null; 934 string threadPoolUsed = null;
906 int maxThreads = 0; 935 int maxThreads = 0;
907 int minThreads = 0; 936 int minThreads = 0;
908 int allocatedThreads = 0; 937 int allocatedThreads = 0;
909 int inUseThreads = 0; 938 int inUseThreads = 0;
910 int waitingCallbacks = 0; 939 int waitingCallbacks = 0;
911 int completionPortThreads = 0;
912 940
913 StringBuilder sb = new StringBuilder();
914 if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool) 941 if (Util.FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
915 { 942 {
916 STPInfo stpi = Util.GetSmartThreadPoolInfo(); 943 STPInfo stpi = Util.GetSmartThreadPoolInfo();
@@ -926,22 +953,10 @@ namespace OpenSim.Framework.Servers
926 waitingCallbacks = stpi.WaitingCallbacks; 953 waitingCallbacks = stpi.WaitingCallbacks;
927 } 954 }
928 } 955 }
929 else if ( 956
930 Util.FireAndForgetMethod == FireAndForgetMethod.QueueUserWorkItem
931 || Util.FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem)
932 {
933 threadPoolUsed = "BuiltInThreadPool";
934 ThreadPool.GetMaxThreads(out maxThreads, out completionPortThreads);
935 ThreadPool.GetMinThreads(out minThreads, out completionPortThreads);
936 int availableThreads;
937 ThreadPool.GetAvailableThreads(out availableThreads, out completionPortThreads);
938 inUseThreads = maxThreads - availableThreads;
939 allocatedThreads = -1;
940 waitingCallbacks = -1;
941 }
942
943 if (threadPoolUsed != null) 957 if (threadPoolUsed != null)
944 { 958 {
959 sb.Append("\nThreadpool (excluding script engine pools)\n");
945 sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed); 960 sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed);
946 sb.AppendFormat("Max threads : {0}\n", maxThreads); 961 sb.AppendFormat("Max threads : {0}\n", maxThreads);
947 sb.AppendFormat("Min threads : {0}\n", minThreads); 962 sb.AppendFormat("Min threads : {0}\n", minThreads);