cosmetics
parent
0cf3ec553a
commit
bd12d60e80
|
@ -52,11 +52,10 @@ namespace OpenSim.Framework.Monitoring
|
|||
Math.Round((MemoryWatchdog.LastHeapAllocationRate * 1000) / 1048576.0, 3),
|
||||
Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1048576.0, 3));
|
||||
|
||||
Process myprocess = Process.GetCurrentProcess();
|
||||
// if (!myprocess.HasExited)
|
||||
try
|
||||
{
|
||||
myprocess.Refresh();
|
||||
using (Process myprocess = Process.GetCurrentProcess())
|
||||
{
|
||||
sb.AppendFormat(
|
||||
"Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n",
|
||||
Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0),
|
||||
|
@ -68,6 +67,7 @@ namespace OpenSim.Framework.Monitoring
|
|||
Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0),
|
||||
Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0));
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
// else
|
||||
|
|
|
@ -435,20 +435,18 @@ Asset service request failures: {3}" + Environment.NewLine,
|
|||
// Get the amount of physical memory, allocated with the instance of this program, in kilobytes;
|
||||
// the working set is the set of memory pages currently visible to this program in physical RAM
|
||||
// memory and includes both shared (e.g. system libraries) and private data
|
||||
double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0;
|
||||
int numberThreadsRunning = 0;
|
||||
double memUsage = 0;
|
||||
using(Process p = Process.GetCurrentProcess())
|
||||
{
|
||||
memUsage = p.WorkingSet64 / 1024.0;
|
||||
|
||||
// Get the number of threads from the system that are currently
|
||||
// running
|
||||
int numberThreadsRunning = 0;
|
||||
foreach (ProcessThread currentThread in
|
||||
Process.GetCurrentProcess().Threads)
|
||||
{
|
||||
// A known issue with the current process .Threads property is
|
||||
// that it can return null threads, thus don't count those as
|
||||
// running threads and prevent the program function from failing
|
||||
if (currentThread != null &&
|
||||
currentThread.ThreadState == ThreadState.Running)
|
||||
|
||||
foreach (ProcessThread currentThread in p.Threads)
|
||||
{
|
||||
if (currentThread != null && currentThread.ThreadState == ThreadState.Running)
|
||||
numberThreadsRunning++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2485,7 +2485,10 @@ namespace OpenSim.Framework
|
|||
case FireAndForgetMethod.SmartThreadPool:
|
||||
return m_ThreadPool.MaxThreads - m_ThreadPool.InUseThreads;
|
||||
case FireAndForgetMethod.Thread:
|
||||
return MAX_SYSTEM_THREADS - System.Diagnostics.Process.GetCurrentProcess().Threads.Count;
|
||||
{
|
||||
using(Process p = System.Diagnostics.Process.GetCurrentProcess())
|
||||
return MAX_SYSTEM_THREADS - p.Threads.Count;
|
||||
}
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
@ -2972,7 +2975,8 @@ namespace OpenSim.Framework
|
|||
|
||||
public static long GetPhysicalMemUse()
|
||||
{
|
||||
return System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;
|
||||
using (Process p = System.Diagnostics.Process.GetCurrentProcess())
|
||||
return p.WorkingSet64;
|
||||
}
|
||||
|
||||
// returns a timestamp in ms as double
|
||||
|
|
|
@ -684,7 +684,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer
|
|||
|
||||
if(destinationHandle == sourceRegion.RegionHandle)
|
||||
{
|
||||
sp.ControllingClient.SendTeleportFailed("Can't teleport to a region on same map position. Try going other region first, then retry");
|
||||
sp.ControllingClient.SendTeleportFailed("Can't teleport to a region on same map position. Try going to another region first, then retry from there");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -3689,7 +3689,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory");
|
||||
|
||||
long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;
|
||||
long pws = Util.GetPhysicalMemUse();
|
||||
|
||||
if (pws > Int32.MaxValue)
|
||||
return Int32.MaxValue;
|
||||
|
@ -3703,9 +3703,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
{
|
||||
CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemoryKB");
|
||||
|
||||
long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64;
|
||||
long pws = Util.GetPhysicalMemUse();
|
||||
|
||||
if((pws & 0x3FFL) != 0)
|
||||
if ((pws & 0x3FFL) != 0)
|
||||
pws += 0x400L;
|
||||
pws >>= 10;
|
||||
|
||||
|
|
Loading…
Reference in New Issue