From 421b562a045c69c5d507ee33e0283613d133e376 Mon Sep 17 00:00:00 2001
From: Justin Clark-Casey (justincc)
Date: Fri, 16 Mar 2012 02:43:33 +0000
Subject: Add process working memory to "show stats" memory statistics.

This shows the actual amount of RAM being taken up by OpenSimulator (objects + vm overhead)
---
 OpenSim/Framework/Statistics/BaseStatsCollector.cs | 8 ++++++--
 OpenSim/Framework/Util.cs                          | 7 +++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

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 @@
  */
 
 using System;
+using System.Diagnostics;
 using System.Text;
-
 using OpenMetaverse;
 using OpenMetaverse.StructuredData;
 
@@ -46,8 +46,12 @@ namespace OpenSim.Framework.Statistics
             sb.Append(Environment.NewLine);
             sb.Append(
                 string.Format(
-                    "Allocated to OpenSim : {0} MB" + Environment.NewLine,
+                    "Allocated to OpenSim objects: {0} MB\n",
                     Math.Round(GC.GetTotalMemory(false) / 1024.0 / 1024.0)));
+            sb.Append(
+                string.Format(
+                    "Process memory              : {0} MB\n",
+                    Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0)));
 
             return sb.ToString();
         }
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs
index efa4a7b..31fa101 100644
--- a/OpenSim/Framework/Util.cs
+++ b/OpenSim/Framework/Util.cs
@@ -81,12 +81,15 @@ namespace OpenSim.Framework
 
         private static uint nextXferID = 5000;
         private static Random randomClass = new Random();
+
         // Get a list of invalid file characters (OS dependent)
         private static string regexInvalidFileChars = "[" + new String(Path.GetInvalidFileNameChars()) + "]";
         private static string regexInvalidPathChars = "[" + new String(Path.GetInvalidPathChars()) + "]";
         private static object XferLock = new object();
-        /// <summary>Thread pool used for Util.FireAndForget if
-        /// FireAndForgetMethod.SmartThreadPool is used</summary>
+
+        /// <summary>
+        /// Thread pool used for Util.FireAndForget if FireAndForgetMethod.SmartThreadPool is used
+        /// </summary>
         private static SmartThreadPool m_ThreadPool;
 
         // 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.
-- 
cgit v1.1