try not to use Process.HasExit that is broken in some mono versions

LSLKeyTest
UbitUmarov 2015-11-24 11:22:40 +00:00
parent 5e4b16658b
commit 19b96697a6
1 changed files with 12 additions and 9 deletions

View File

@ -56,22 +56,25 @@ namespace OpenSim.Framework.Monitoring
Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1024.0 / 1024, 3));
Process myprocess = Process.GetCurrentProcess();
if (!myprocess.HasExited)
// if (!myprocess.HasExited)
try
{
myprocess.Refresh();
sb.AppendFormat(
"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));
Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0),
Math.Round(myprocess.PagedMemorySize64 / 1024.0 / 1024.0),
Math.Round(myprocess.VirtualMemorySize64 / 1024.0 / 1024.0));
sb.AppendFormat(
"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));
Math.Round(myprocess.PeakWorkingSet64 / 1024.0 / 1024.0),
Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0),
Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0));
}
else
sb.Append("Process reported as Exited \n");
catch
{ }
// else
// sb.Append("Process reported as Exited \n");
return sb.ToString();
}