From b5b763f7e1a7c77239bf9fa9bfaabd0f8daa8a81 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 10 Jul 2012 19:13:24 +0100 Subject: add some more memory information to StatsCollector --- OpenSim/Framework/Statistics/BaseStatsCollector.cs | 24 ++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/Statistics/BaseStatsCollector.cs b/OpenSim/Framework/Statistics/BaseStatsCollector.cs index c9e57ce..3f918f3 100644 --- a/OpenSim/Framework/Statistics/BaseStatsCollector.cs +++ b/OpenSim/Framework/Statistics/BaseStatsCollector.cs @@ -48,10 +48,26 @@ namespace OpenSim.Framework.Statistics string.Format( "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))); + + Process myprocess = Process.GetCurrentProcess(); + if (!myprocess.HasExited) + { + myprocess.Refresh(); + sb.Append( + string.Format( + "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", + Math.Round(Process.GetCurrentProcess().WorkingSet64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().PagedMemorySize64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().VirtualMemorySize64 / 1024.0 / 1024.0))); + sb.Append( + string.Format( + "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", + Math.Round(Process.GetCurrentProcess().PeakWorkingSet64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().PeakPagedMemorySize64 / 1024.0 / 1024.0), + Math.Round(Process.GetCurrentProcess().PeakVirtualMemorySize64 / 1024.0 / 1024.0))); + } + else + sb.Append("Process reported as Exited \n"); return sb.ToString(); } -- cgit v1.1