aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Monitoring/ServerStatsCollector.cs8
-rw-r--r--OpenSim/Framework/Servers/ServerBase.cs61
2 files changed, 45 insertions, 24 deletions
diff --git a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
index 3391240..a26a6e0 100644
--- a/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
+++ b/OpenSim/Framework/Monitoring/ServerStatsCollector.cs
@@ -88,7 +88,7 @@ namespace OpenSim.Framework.Monitoring
88 IConfig cfg = source.Configs["Monitoring"]; 88 IConfig cfg = source.Configs["Monitoring"];
89 89
90 if (cfg != null) 90 if (cfg != null)
91 Enabled = cfg.GetBoolean("ServerStatsEnabled", true); 91 Enabled = cfg.GetBoolean("ServerStatsEnabled", false);
92 92
93 if (Enabled) 93 if (Enabled)
94 { 94 {
@@ -98,12 +98,18 @@ namespace OpenSim.Framework.Monitoring
98 98
99 public void Start() 99 public void Start()
100 { 100 {
101 if(!Enabled)
102 return;
103
101 if (RegisteredStats.Count == 0) 104 if (RegisteredStats.Count == 0)
102 RegisterServerStats(); 105 RegisterServerStats();
103 } 106 }
104 107
105 public void Close() 108 public void Close()
106 { 109 {
110 if(!Enabled)
111 return;
112
107 if (RegisteredStats.Count > 0) 113 if (RegisteredStats.Count > 0)
108 { 114 {
109 foreach (Stat stat in RegisteredStats.Values) 115 foreach (Stat stat in RegisteredStats.Values)
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);