aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/Util.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2014-11-04 00:55:48 +0000
committerJustin Clark-Casey (justincc)2014-11-25 23:23:10 +0000
commitec8d21c434a39f46518ee9cf9f5539d1790eacc0 (patch)
tree2aa340fb34c6f6e8e8f2e31c2034b5841307a7bf /OpenSim/Framework/Util.cs
parentAdd "show threadpool calls" command to show count of all labelled smartthread... (diff)
downloadopensim-SC-ec8d21c434a39f46518ee9cf9f5539d1790eacc0.zip
opensim-SC-ec8d21c434a39f46518ee9cf9f5539d1790eacc0.tar.gz
opensim-SC-ec8d21c434a39f46518ee9cf9f5539d1790eacc0.tar.bz2
opensim-SC-ec8d21c434a39f46518ee9cf9f5539d1790eacc0.tar.xz
Label all threadpool calls being made in core OpenSimulator. This is to add problem diagnosis.
"show threadpool calls" now also returns named (labelled), anonymous (unlabelled) and total call stats.
Diffstat (limited to 'OpenSim/Framework/Util.cs')
-rw-r--r--OpenSim/Framework/Util.cs23
1 files changed, 13 insertions, 10 deletions
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 53bbb06..baad0b9 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -1928,11 +1928,6 @@ namespace OpenSim.Framework
1928 } 1928 }
1929 } 1929 }
1930 1930
1931 public static void FireAndForget(System.Threading.WaitCallback callback)
1932 {
1933 FireAndForget(callback, null, null);
1934 }
1935
1936 public static void InitThreadPool(int minThreads, int maxThreads) 1931 public static void InitThreadPool(int minThreads, int maxThreads)
1937 { 1932 {
1938 if (maxThreads < 2) 1933 if (maxThreads < 2)
@@ -1977,8 +1972,7 @@ namespace OpenSim.Framework
1977 throw new NotImplementedException(); 1972 throw new NotImplementedException();
1978 } 1973 }
1979 } 1974 }
1980 1975
1981
1982 /// <summary> 1976 /// <summary>
1983 /// Additional information about threads in the main thread pool. Used to time how long the 1977 /// Additional information about threads in the main thread pool. Used to time how long the
1984 /// thread has been running, and abort it if it has timed-out. 1978 /// thread has been running, and abort it if it has timed-out.
@@ -2052,10 +2046,10 @@ namespace OpenSim.Framework
2052 } 2046 }
2053 } 2047 }
2054 2048
2055
2056 private static long nextThreadFuncNum = 0; 2049 private static long nextThreadFuncNum = 0;
2057 private static long numQueuedThreadFuncs = 0; 2050 private static long numQueuedThreadFuncs = 0;
2058 private static long numRunningThreadFuncs = 0; 2051 private static long numRunningThreadFuncs = 0;
2052 private static long numTotalThreadFuncsCalled = 0;
2059 private static Int32 threadFuncOverloadMode = 0; 2053 private static Int32 threadFuncOverloadMode = 0;
2060 2054
2061 // Maps (ThreadFunc number -> Thread) 2055 // Maps (ThreadFunc number -> Thread)
@@ -2086,20 +2080,29 @@ namespace OpenSim.Framework
2086 } 2080 }
2087 } 2081 }
2088 2082
2083 public static long TotalFireAndForgetCallsMade { get { return numTotalThreadFuncsCalled; } }
2084
2089 public static Dictionary<string, int> GetFireAndForgetCallsMade() 2085 public static Dictionary<string, int> GetFireAndForgetCallsMade()
2090 { 2086 {
2091 return new Dictionary<string, int>(m_fireAndForgetCallsMade); 2087 return new Dictionary<string, int>(m_fireAndForgetCallsMade);
2092 } 2088 }
2093 2089
2094 private static Dictionary<string, int> m_fireAndForgetCallsMade = new Dictionary<string, int>(); 2090 private static Dictionary<string, int> m_fireAndForgetCallsMade = new Dictionary<string, int>();
2095 2091
2092 public static void FireAndForget(System.Threading.WaitCallback callback)
2093 {
2094 FireAndForget(callback, null, null);
2095 }
2096
2096 public static void FireAndForget(System.Threading.WaitCallback callback, object obj) 2097 public static void FireAndForget(System.Threading.WaitCallback callback, object obj)
2097 { 2098 {
2098 FireAndForget(callback, obj, null); 2099 FireAndForget(callback, obj, null);
2099 } 2100 }
2100 2101
2101 public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context) 2102 public static void FireAndForget(System.Threading.WaitCallback callback, object obj, string context)
2102 { 2103 {
2104 Interlocked.Increment(ref numTotalThreadFuncsCalled);
2105
2103 if (context != null) 2106 if (context != null)
2104 { 2107 {
2105 if (!m_fireAndForgetCallsMade.ContainsKey(context)) 2108 if (!m_fireAndForgetCallsMade.ContainsKey(context))