diff options
author | UbitUmarov | 2019-11-20 23:16:20 +0000 |
---|---|---|
committer | UbitUmarov | 2019-11-20 23:16:20 +0000 |
commit | bd12d60e80b6f051a9e4f4470c7621e5ad098380 (patch) | |
tree | ba511769ca0ea52e114168920c5773a9872955c4 /OpenSim | |
parent | fix the block of teleport to same region handle (diff) | |
download | opensim-SC-bd12d60e80b6f051a9e4f4470c7621e5ad098380.zip opensim-SC-bd12d60e80b6f051a9e4f4470c7621e5ad098380.tar.gz opensim-SC-bd12d60e80b6f051a9e4f4470c7621e5ad098380.tar.bz2 opensim-SC-bd12d60e80b6f051a9e4f4470c7621e5ad098380.tar.xz |
cosmetics
Diffstat (limited to 'OpenSim')
5 files changed, 33 insertions, 31 deletions
diff --git a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs index b5df94b..7119964 100644 --- a/OpenSim/Framework/Monitoring/BaseStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/BaseStatsCollector.cs | |||
@@ -52,21 +52,21 @@ namespace OpenSim.Framework.Monitoring | |||
52 | Math.Round((MemoryWatchdog.LastHeapAllocationRate * 1000) / 1048576.0, 3), | 52 | Math.Round((MemoryWatchdog.LastHeapAllocationRate * 1000) / 1048576.0, 3), |
53 | Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1048576.0, 3)); | 53 | Math.Round((MemoryWatchdog.AverageHeapAllocationRate * 1000) / 1048576.0, 3)); |
54 | 54 | ||
55 | Process myprocess = Process.GetCurrentProcess(); | ||
56 | // if (!myprocess.HasExited) | ||
57 | try | 55 | try |
58 | { | 56 | { |
59 | myprocess.Refresh(); | 57 | using (Process myprocess = Process.GetCurrentProcess()) |
60 | sb.AppendFormat( | 58 | { |
61 | "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", | 59 | sb.AppendFormat( |
62 | Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0), | 60 | "Process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", |
63 | Math.Round(myprocess.PagedMemorySize64 / 1024.0 / 1024.0), | 61 | Math.Round(myprocess.WorkingSet64 / 1024.0 / 1024.0), |
64 | Math.Round(myprocess.VirtualMemorySize64 / 1024.0 / 1024.0)); | 62 | Math.Round(myprocess.PagedMemorySize64 / 1024.0 / 1024.0), |
65 | sb.AppendFormat( | 63 | Math.Round(myprocess.VirtualMemorySize64 / 1024.0 / 1024.0)); |
66 | "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", | 64 | sb.AppendFormat( |
67 | Math.Round(myprocess.PeakWorkingSet64 / 1024.0 / 1024.0), | 65 | "Peak process memory: Physical {0} MB \t Paged {1} MB \t Virtual {2} MB\n", |
68 | Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0), | 66 | Math.Round(myprocess.PeakWorkingSet64 / 1024.0 / 1024.0), |
69 | Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0)); | 67 | Math.Round(myprocess.PeakPagedMemorySize64 / 1024.0 / 1024.0), |
68 | Math.Round(myprocess.PeakVirtualMemorySize64 / 1024.0 / 1024.0)); | ||
69 | } | ||
70 | } | 70 | } |
71 | catch | 71 | catch |
72 | { } | 72 | { } |
diff --git a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs index 88a0297..c41c4b9 100755 --- a/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs +++ b/OpenSim/Framework/Monitoring/SimExtraStatsCollector.cs | |||
@@ -435,21 +435,19 @@ Asset service request failures: {3}" + Environment.NewLine, | |||
435 | // Get the amount of physical memory, allocated with the instance of this program, in kilobytes; | 435 | // Get the amount of physical memory, allocated with the instance of this program, in kilobytes; |
436 | // the working set is the set of memory pages currently visible to this program in physical RAM | 436 | // the working set is the set of memory pages currently visible to this program in physical RAM |
437 | // memory and includes both shared (e.g. system libraries) and private data | 437 | // memory and includes both shared (e.g. system libraries) and private data |
438 | double memUsage = Process.GetCurrentProcess().WorkingSet64 / 1024.0; | ||
439 | |||
440 | // Get the number of threads from the system that are currently | ||
441 | // running | ||
442 | int numberThreadsRunning = 0; | 438 | int numberThreadsRunning = 0; |
443 | foreach (ProcessThread currentThread in | 439 | double memUsage = 0; |
444 | Process.GetCurrentProcess().Threads) | 440 | using(Process p = Process.GetCurrentProcess()) |
445 | { | 441 | { |
446 | // A known issue with the current process .Threads property is | 442 | memUsage = p.WorkingSet64 / 1024.0; |
447 | // that it can return null threads, thus don't count those as | 443 | |
448 | // running threads and prevent the program function from failing | 444 | // Get the number of threads from the system that are currently |
449 | if (currentThread != null && | 445 | // running |
450 | currentThread.ThreadState == ThreadState.Running) | 446 | |
447 | foreach (ProcessThread currentThread in p.Threads) | ||
451 | { | 448 | { |
452 | numberThreadsRunning++; | 449 | if (currentThread != null && currentThread.ThreadState == ThreadState.Running) |
450 | numberThreadsRunning++; | ||
453 | } | 451 | } |
454 | } | 452 | } |
455 | 453 | ||
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 03e8852..e0e35db 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -2485,7 +2485,10 @@ namespace OpenSim.Framework | |||
2485 | case FireAndForgetMethod.SmartThreadPool: | 2485 | case FireAndForgetMethod.SmartThreadPool: |
2486 | return m_ThreadPool.MaxThreads - m_ThreadPool.InUseThreads; | 2486 | return m_ThreadPool.MaxThreads - m_ThreadPool.InUseThreads; |
2487 | case FireAndForgetMethod.Thread: | 2487 | case FireAndForgetMethod.Thread: |
2488 | return MAX_SYSTEM_THREADS - System.Diagnostics.Process.GetCurrentProcess().Threads.Count; | 2488 | { |
2489 | using(Process p = System.Diagnostics.Process.GetCurrentProcess()) | ||
2490 | return MAX_SYSTEM_THREADS - p.Threads.Count; | ||
2491 | } | ||
2489 | default: | 2492 | default: |
2490 | throw new NotImplementedException(); | 2493 | throw new NotImplementedException(); |
2491 | } | 2494 | } |
@@ -2972,7 +2975,8 @@ namespace OpenSim.Framework | |||
2972 | 2975 | ||
2973 | public static long GetPhysicalMemUse() | 2976 | public static long GetPhysicalMemUse() |
2974 | { | 2977 | { |
2975 | return System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; | 2978 | using (Process p = System.Diagnostics.Process.GetCurrentProcess()) |
2979 | return p.WorkingSet64; | ||
2976 | } | 2980 | } |
2977 | 2981 | ||
2978 | // returns a timestamp in ms as double | 2982 | // returns a timestamp in ms as double |
diff --git a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs index 07b2a8e..fa49546 100644 --- a/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs +++ b/OpenSim/Region/CoreModules/Framework/EntityTransfer/EntityTransferModule.cs | |||
@@ -684,7 +684,7 @@ namespace OpenSim.Region.CoreModules.Framework.EntityTransfer | |||
684 | 684 | ||
685 | if(destinationHandle == sourceRegion.RegionHandle) | 685 | if(destinationHandle == sourceRegion.RegionHandle) |
686 | { | 686 | { |
687 | sp.ControllingClient.SendTeleportFailed("Can't teleport to a region on same map position. Try going other region first, then retry"); | 687 | sp.ControllingClient.SendTeleportFailed("Can't teleport to a region on same map position. Try going to another region first, then retry from there"); |
688 | return; | 688 | return; |
689 | } | 689 | } |
690 | 690 | ||
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 3cb0fe7..eb7049e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -3689,7 +3689,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3689 | { | 3689 | { |
3690 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); | 3690 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemory"); |
3691 | 3691 | ||
3692 | long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; | 3692 | long pws = Util.GetPhysicalMemUse(); |
3693 | 3693 | ||
3694 | if (pws > Int32.MaxValue) | 3694 | if (pws > Int32.MaxValue) |
3695 | return Int32.MaxValue; | 3695 | return Int32.MaxValue; |
@@ -3703,9 +3703,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3703 | { | 3703 | { |
3704 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemoryKB"); | 3704 | CheckThreatLevel(ThreatLevel.Moderate, "osGetSimulatorMemoryKB"); |
3705 | 3705 | ||
3706 | long pws = System.Diagnostics.Process.GetCurrentProcess().WorkingSet64; | 3706 | long pws = Util.GetPhysicalMemUse(); |
3707 | 3707 | ||
3708 | if((pws & 0x3FFL) != 0) | 3708 | if ((pws & 0x3FFL) != 0) |
3709 | pws += 0x400L; | 3709 | pws += 0x400L; |
3710 | pws >>= 10; | 3710 | pws >>= 10; |
3711 | 3711 | ||