aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authorMelanie2012-03-18 20:44:56 +0000
committerMelanie2012-03-18 20:44:56 +0000
commitc7e302864a2eef7f9587ed22286c96a6074ac5b3 (patch)
tree8f0df2f66811309fd790966770434fa3ff68bfdf /OpenSim/Framework
parentMerge branch 'ubitwork' (diff)
parentAmend to previous commit: normalize strings ToLower. (diff)
downloadopensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.zip
opensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.gz
opensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.bz2
opensim-SC_OLD-c7e302864a2eef7f9587ed22286c96a6074ac5b3.tar.xz
Merge branch 'master' into careminster
Conflicts: OpenSim/Region/CoreModules/World/Estate/EstateManagementModule.cs OpenSim/Region/Framework/Scenes/Scene.PacketHandlers.cs OpenSim/Region/Framework/Scenes/Scene.cs
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/Servers/BaseOpenSimServer.cs16
-rw-r--r--OpenSim/Framework/Statistics/BaseStatsCollector.cs8
-rw-r--r--OpenSim/Framework/Util.cs63
3 files changed, 76 insertions, 11 deletions
diff --git a/OpenSim/Framework/Servers/BaseOpenSimServer.cs b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
index f4d541e..87d04f8 100644
--- a/OpenSim/Framework/Servers/BaseOpenSimServer.cs
+++ b/OpenSim/Framework/Servers/BaseOpenSimServer.cs
@@ -269,15 +269,19 @@ namespace OpenSim.Framework.Servers
269 t.Priority, 269 t.Priority,
270 t.ThreadState); 270 t.ThreadState);
271 271
272 sb.Append(Environment.NewLine); 272 sb.Append("\n");
273 } 273 }
274 274
275 int workers = 0, ports = 0, maxWorkers = 0, maxPorts = 0; 275 sb.Append("\n");
276 ThreadPool.GetAvailableThreads(out workers, out ports);
277 ThreadPool.GetMaxThreads(out maxWorkers, out maxPorts);
278 276
279 sb.Append(Environment.NewLine + "*** ThreadPool threads ***" + Environment.NewLine); 277 // For some reason mono 2.6.7 returns an empty threads set! Not going to confuse people by reporting
280 sb.Append("workers: " + (maxWorkers - workers) + " (" + maxWorkers + "); ports: " + (maxPorts - ports) + " (" + maxPorts + ")" + Environment.NewLine); 278 // zero active threads.
279 int totalThreads = Process.GetCurrentProcess().Threads.Count;
280 if (totalThreads > 0)
281 sb.AppendFormat("Total threads active: {0}\n\n", totalThreads);
282
283 sb.Append("Main threadpool (excluding script engine pools)\n");
284 sb.Append(Util.GetThreadPoolReport());
281 285
282 return sb.ToString(); 286 return sb.ToString();
283 } 287 }
diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs
index a1841c5..c9e57ce 100644
--- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs
+++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs
@@ -26,8 +26,8 @@
26 */ 26 */
27 27
28using System; 28using System;
29using System.Diagnostics;
29using System.Text; 30using System.Text;
30
31using OpenMetaverse; 31using OpenMetaverse;
32using OpenMetaverse.StructuredData; 32using OpenMetaverse.StructuredData;
33 33
@@ -46,8 +46,12 @@ namespace OpenSim.Framework.Statistics
46 sb.Append(Environment.NewLine); 46 sb.Append(Environment.NewLine);
47 sb.Append( 47 sb.Append(
48 string.Format( 48 string.Format(
49 "Allocated to OpenSim : {0} MB" + Environment.NewLine, 49 "Allocated to OpenSim objects: {0} MB\n",
50 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0))); 50 Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
51 sb.Append(
52 string.Format(
53 "Process memory : {0} MB\n",
54 Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)));
51 55
52 return sb.ToString(); 56 return sb.ToString();
53 } 57 }
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index 02da7f4..a695542 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -81,12 +81,15 @@ namespace OpenSim.Framework
81 81
82 private static uint nextXferID = 5000; 82 private static uint nextXferID = 5000;
83 private static Random randomClass = new Random(); 83 private static Random randomClass = new Random();
84
84 // Get a list of invalid file characters (OS dependent) 85 // Get a list of invalid file characters (OS dependent)
85 private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]"; 86 private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
86 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]"; 87 private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
87 private static object XferLock = new object(); 88 private static object XferLock = new object();
88 /// <summary>Thread pool used for Util.FireAndForget if 89
89 /// FireAndForgetMethod.SmartThreadPool is used</summary> 90 /// <summary>
91 /// Thread pool used for Util.FireAndForget if FireAndForgetMethod.SmartThreadPool is used
92 /// </summary>
90 private static SmartThreadPool m_ThreadPool; 93 private static SmartThreadPool m_ThreadPool;
91 94
92 // Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC. 95 // Unix-epoch starts at January 1st 1970, 00:00:00 UTC. And all our times in the server are (or at least should be) in UTC.
@@ -144,7 +147,6 @@ namespace OpenSim.Framework
144 return lerp(y, lerp(x, a, b), lerp(x, c, d)); 147 return lerp(y, lerp(x, a, b), lerp(x, c, d));
145 } 148 }
146 149
147
148 public static Encoding UTF8 = Encoding.UTF8; 150 public static Encoding UTF8 = Encoding.UTF8;
149 151
150 /// <value> 152 /// <value>
@@ -1683,6 +1685,61 @@ namespace OpenSim.Framework
1683 } 1685 }
1684 } 1686 }
1685 1687
1688 /// <summary>
1689 /// Get a thread pool report.
1690 /// </summary>
1691 /// <returns></returns>
1692 public static string GetThreadPoolReport()
1693 {
1694 string threadPoolUsed = null;
1695 int maxThreads = 0;
1696 int minThreads = 0;
1697 int allocatedThreads = 0;
1698 int inUseThreads = 0;
1699 int waitingCallbacks = 0;
1700 int completionPortThreads = 0;
1701
1702 StringBuilder sb = new StringBuilder();
1703 if (FireAndForgetMethod == FireAndForgetMethod.SmartThreadPool)
1704 {
1705 threadPoolUsed = "SmartThreadPool";
1706 maxThreads = m_ThreadPool.MaxThreads;
1707 minThreads = m_ThreadPool.MinThreads;
1708 inUseThreads = m_ThreadPool.InUseThreads;
1709 allocatedThreads = m_ThreadPool.ActiveThreads;
1710 waitingCallbacks = m_ThreadPool.WaitingCallbacks;
1711 }
1712 else if (
1713 FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem
1714 || FireAndForgetMethod == FireAndForgetMethod.UnsafeQueueUserWorkItem)
1715 {
1716 threadPoolUsed = "BuiltInThreadPool";
1717 ThreadPool.GetMaxThreads(out maxThreads, out completionPortThreads);
1718 ThreadPool.GetMinThreads(out minThreads, out completionPortThreads);
1719 int availableThreads;
1720 ThreadPool.GetAvailableThreads(out availableThreads, out completionPortThreads);
1721 inUseThreads = maxThreads - availableThreads;
1722 allocatedThreads = -1;
1723 waitingCallbacks = -1;
1724 }
1725
1726 if (threadPoolUsed != null)
1727 {
1728 sb.AppendFormat("Thread pool used : {0}\n", threadPoolUsed);
1729 sb.AppendFormat("Max threads : {0}\n", maxThreads);
1730 sb.AppendFormat("Min threads : {0}\n", minThreads);
1731 sb.AppendFormat("Allocated threads : {0}\n", allocatedThreads < 0 ? "not applicable" : allocatedThreads.ToString());
1732 sb.AppendFormat("In use threads : {0}\n", inUseThreads);
1733 sb.AppendFormat("Work items waiting : {0}\n", waitingCallbacks < 0 ? "not available" : waitingCallbacks.ToString());
1734 }
1735 else
1736 {
1737 sb.AppendFormat("Thread pool not used\n");
1738 }
1739
1740 return sb.ToString();
1741 }
1742
1686 private static object SmartThreadPoolCallback(object o) 1743 private static object SmartThreadPoolCallback(object o)
1687 { 1744 {
1688 object[] array = (object[])o; 1745 object[] array = (object[])o;