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