summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMaoni Stephens <Maoni0@users.noreply.github.com>2019-01-29 13:09:32 -0800
committerGitHub <noreply@github.com>2019-01-29 13:09:32 -0800
commited52a006c01a582d4d34add40c318d6f324b99ba (patch)
tree206844e7a9ececb7960a9cdd47e899718269644a /tests
parent930abba4060fb528db2bb9835a1bc5a6e684bfec (diff)
downloadcoreclr-ed52a006c01a582d4d34add40c318d6f324b99ba.tar.gz
coreclr-ed52a006c01a582d4d34add40c318d6f324b99ba.tar.bz2
coreclr-ed52a006c01a582d4d34add40c318d6f324b99ba.zip
To support container scenario, 2 HardLimit configs are added - (#22180)
GCHeapHardLimit - specifies a hard limit for the GC heap GCHeapHardLimitPercent - specifies a percentage of the physical memory this process is allowed to use If both are specified, GCHeapHardLimit is checked first and only when it's not specified would we check GCHeapHardLimitPercent. If neither is specified but the process is running inside a container with a memory limit specified, we will take this as the hard limit: max (20mb, 75% of the memory limit on the container) If one of the HardLimit configs is specified, and the process is running inside a container with a memory limit, the GC heap usage will not exceed the HardLimit but the total memory is still the memory limit on the container so when we calculate the memory load it's based off the container memory limit. An example, process is running inside a container with 200mb limit user also specified GCHeapHardLimit as 100mb. if 50mb out of the 100mb is used for GC, and 100mb is used for other things, the memory load is (50 + 100)/200 = 75%. Some notes on these configs - + The limit is the commit size. + This is only supported on 64-bit. + For Server GC the minimum *reserved* segment size is 16mb per heap, this is to avoid the scenario where the hard limit is small but the process can use many procs and we end up with tiny segments which doesn't make sense. We then keep track of the committed on the segments so the total does not exceed the hard limit.
Diffstat (limited to 'tests')
-rw-r--r--tests/src/GC/Performance/Tests/GCSmall.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/tests/src/GC/Performance/Tests/GCSmall.cs b/tests/src/GC/Performance/Tests/GCSmall.cs
index e9c452bb35..5ce028f15d 100644
--- a/tests/src/GC/Performance/Tests/GCSmall.cs
+++ b/tests/src/GC/Performance/Tests/GCSmall.cs
@@ -3,6 +3,8 @@
// See the LICENSE file in the project root for more information.
using System;
+using System.Diagnostics;
+
internal class GCSmall
{
@@ -11,9 +13,12 @@ internal class GCSmall
public static void Main(string[] p_args)
{
- long iterations = 200;
+ long iterations = 200000000;
GCSmall ns = new GCSmall();
+ Stopwatch sw = new Stopwatch();
+ sw.Start();
+
for (long i = 0; i < iterations; i++)
{
ns = new GCSmall();
@@ -32,5 +37,8 @@ internal class GCSmall
Console.WriteLine("Shouldn't get here");
GC.KeepAlive(ns);
+
+ sw.Stop();
+ Console.WriteLine("took {0} ms in total", sw.ElapsedMilliseconds);
}
}