@@ -119,10 +119,23 @@ public void MemoryDiagnoserDoesNotIncludeAllocationsFromSetupAndCleanup(IToolcha
119
119
} ) ;
120
120
}
121
121
122
- public class NoAllocationsAtAll
122
+ public class EmptyBenchmark
123
123
{
124
124
[ Benchmark ] public void EmptyMethod ( ) { }
125
+ }
126
+
127
+ [ Theory , MemberData ( nameof ( GetToolchains ) , DisableDiscoveryEnumeration = true ) ]
128
+ [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
129
+ public void EngineShouldNotInterfereAllocationResults ( IToolchain toolchain )
130
+ {
131
+ AssertAllocations ( toolchain , typeof ( EmptyBenchmark ) , new Dictionary < string , long >
132
+ {
133
+ { nameof ( EmptyBenchmark . EmptyMethod ) , 0 }
134
+ } ) ;
135
+ }
125
136
137
+ public class TimeConsumingBenchmark
138
+ {
126
139
[ Benchmark ]
127
140
public ulong TimeConsuming ( )
128
141
{
@@ -135,24 +148,14 @@ public ulong TimeConsuming()
135
148
}
136
149
}
137
150
138
- [ Theory , MemberData ( nameof ( GetToolchains ) , DisableDiscoveryEnumeration = true ) ]
139
- [ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
140
- public void EngineShouldNotInterfereAllocationResults ( IToolchain toolchain )
141
- {
142
- AssertAllocations ( toolchain , typeof ( NoAllocationsAtAll ) , new Dictionary < string , long >
143
- {
144
- { nameof ( NoAllocationsAtAll . EmptyMethod ) , 0 }
145
- } ) ;
146
- }
147
-
148
151
// #1542
149
152
[ Theory , MemberData ( nameof ( GetToolchains ) , DisableDiscoveryEnumeration = true ) ]
150
153
[ Trait ( Constants . Category , Constants . BackwardCompatibilityCategory ) ]
151
154
public void TieredJitShouldNotInterfereAllocationResults ( IToolchain toolchain )
152
155
{
153
- AssertAllocations ( toolchain , typeof ( NoAllocationsAtAll ) , new Dictionary < string , long >
156
+ AssertAllocations ( toolchain , typeof ( TimeConsumingBenchmark ) , new Dictionary < string , long >
154
157
{
155
- { nameof ( NoAllocationsAtAll . TimeConsuming ) , 0 }
158
+ { nameof ( TimeConsumingBenchmark . TimeConsuming ) , 0 }
156
159
} ,
157
160
disableTieredJit : false , iterationCount : 10 ) ; // 1 iteration is not enough to repro the problem
158
161
}
0 commit comments