Skip to content

Commit b3f2aaf

Browse files
committed
Added TaskNoAllocate in MemoryDiagnoserSurvivedIsAccurate test.
1 parent 32aecbb commit b3f2aaf

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tests/BenchmarkDotNet.IntegrationTests/MemoryDiagnoserTests.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,17 @@ public class AccurateSurvived
8282
public byte[] bytes64;
8383
public Task<int> task;
8484

85-
[GlobalSetup(Targets = new string[] { nameof(EightBytesArrayNoAllocate), nameof(SixtyFourBytesArrayNoAllocate) })]
85+
[GlobalSetup(Targets = new string[] { nameof(EightBytesArrayNoAllocate), nameof(SixtyFourBytesArrayNoAllocate), nameof(TaskNoAllocate) })]
8686
public void SetupNoAllocate()
8787
{
8888
bytes8 = new byte[8];
8989
bytes64 = new byte[64];
90+
task = Task.FromResult(default(int));
9091
}
9192

9293
[Benchmark] public byte[] EightBytesArrayNoAllocate() => bytes8;
9394
[Benchmark] public byte[] SixtyFourBytesArrayNoAllocate() => bytes64;
95+
[Benchmark] public Task<int> TaskNoAllocate() => task;
9496

9597

9698
[Benchmark] public void EightBytesArraySurvive() => bytes8 = new byte[8];
@@ -118,6 +120,7 @@ public void MemoryDiagnoserSurvivedIsAccurate(IToolchain toolchain)
118120

119121
{ nameof(AccurateSurvived.EightBytesArrayNoAllocate), 0 },
120122
{ nameof(AccurateSurvived.SixtyFourBytesArrayNoAllocate), 0 },
123+
{ nameof(AccurateSurvived.TaskNoAllocate), 0 },
121124

122125
{ nameof(AccurateSurvived.EightBytesArraySurvive), 8 + objectAllocationOverhead + arraySizeOverhead },
123126
{ nameof(AccurateSurvived.SixtyFourBytesArraySurvive), 64 + objectAllocationOverhead + arraySizeOverhead },

0 commit comments

Comments
 (0)