Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public void AllocationQuantumIsNotAnIssueForNetCore21Plus(IToolchain toolchain)
AssertAllocations(toolchain, typeof(TimeConsuming), new Dictionary<string, long>
{
{ nameof(TimeConsuming.SixtyFourBytesArray), 64 + objectAllocationOverhead + arraySizeOverhead }
});
}, warmupCount: 2);
}

public class MultiThreadedAllocation
Expand Down Expand Up @@ -315,9 +315,9 @@ public void MemoryDiagnoserIsAccurateForMultiThreadedBenchmarks(IToolchain toolc
});
}

private void AssertAllocations(IToolchain toolchain, Type benchmarkType, Dictionary<string, long> benchmarksAllocationsValidators, bool disableTieredJit = true, int iterationCount = 1)
private void AssertAllocations(IToolchain toolchain, Type benchmarkType, Dictionary<string, long> benchmarksAllocationsValidators, bool disableTieredJit = true, int iterationCount = 1, int warmupCount = 0)
{
var config = CreateConfig(toolchain, disableTieredJit, iterationCount);
var config = CreateConfig(toolchain, disableTieredJit, iterationCount, warmupCount);
var benchmarks = BenchmarkConverter.TypeToBenchmarks(benchmarkType, config);

var summary = BenchmarkRunner.Run(benchmarks);
Expand Down Expand Up @@ -358,11 +358,13 @@ private IConfig CreateConfig(IToolchain toolchain,
// This was mostly fixed in net7.0, but tiered jit thread is not guaranteed to not allocate, so we disable it just in case.
bool disableTieredJit = true,
// Single iteration is enough for most of the tests.
int iterationCount = 1)
int iterationCount = 1,
// Don't run warmup by default to save some time for our CI runs
int warmupCount = 0)
{
var job = Job.ShortRun
.WithEvaluateOverhead(false) // no need to run idle for this test
.WithWarmupCount(0) // don't run warmup to save some time for our CI runs
.WithWarmupCount(warmupCount)
.WithIterationCount(iterationCount)
.WithGcForce(false)
.WithGcServer(false)
Expand Down