@@ -109,9 +109,6 @@ private void AssertZeroResults(Type benchmarkType, IConfig config)
109
109
. AddDiagnoser ( new MemoryDiagnoser ( new MemoryDiagnoserConfig ( false ) ) )
110
110
) ;
111
111
112
- var cpuResolution = RuntimeInformation . GetCpuInfo ( ) . MaxFrequency ? . ToResolution ( ) ?? FallbackCpuResolutionValue ;
113
- var cpuGhz = cpuResolution . ToFrequency ( ) . ToGHz ( ) ;
114
-
115
112
foreach ( var report in summary . Reports )
116
113
{
117
114
var workloadMeasurements = report . AllMeasurements . Where ( m => m . Is ( IterationMode . Workload , IterationStage . Actual ) ) . GetStatistics ( ) . WithoutOutliers ( ) ;
@@ -120,11 +117,8 @@ private void AssertZeroResults(Type benchmarkType, IConfig config)
120
117
bool isZero = ZeroMeasurementHelper . CheckZeroMeasurementTwoSamples ( workloadMeasurements , overheadMeasurements ) ;
121
118
Assert . True ( isZero , $ "Actual time was not 0.") ;
122
119
123
- var workloadTime = workloadMeasurements . Average ( ) ;
124
- var overheadTime = overheadMeasurements . Average ( ) ;
125
-
126
- // Allow for 1 cpu cycle variance
127
- Assert . True ( overheadTime * cpuGhz < workloadTime * cpuGhz + 1 , "Overhead took more time than workload." ) ;
120
+ isZero = ZeroMeasurementHelper . CheckZeroMeasurementTwoSamples ( overheadMeasurements , workloadMeasurements ) ;
121
+ Assert . True ( isZero , "Overhead took more time than workload." ) ;
128
122
129
123
Assert . True ( ( report . GcStats . GetBytesAllocatedPerOperation ( report . BenchmarkCase ) ?? 0L ) == 0L , "Memory allocations measured above 0." ) ;
130
124
}
@@ -168,9 +162,6 @@ private void AssertDifferentSizedStructsResults(IConfig config)
168
162
. AddDiagnoser ( new MemoryDiagnoser ( new MemoryDiagnoserConfig ( false ) ) )
169
163
) ;
170
164
171
- var cpuResolution = RuntimeInformation . GetCpuInfo ( ) . MaxFrequency ? . ToResolution ( ) ?? FallbackCpuResolutionValue ;
172
- var cpuGhz = cpuResolution . ToFrequency ( ) . ToGHz ( ) ;
173
-
174
165
foreach ( var report in summary . Reports )
175
166
{
176
167
var workloadMeasurements = report . AllMeasurements . Where ( m => m . Is ( IterationMode . Workload , IterationStage . Actual ) ) . GetStatistics ( ) . WithoutOutliers ( ) ;
@@ -179,11 +170,8 @@ private void AssertDifferentSizedStructsResults(IConfig config)
179
170
bool isZero = ZeroMeasurementHelper . CheckZeroMeasurementTwoSamples ( workloadMeasurements , overheadMeasurements ) ;
180
171
Assert . False ( isZero , $ "Actual time was 0.") ;
181
172
182
- var workloadTime = workloadMeasurements . Average ( ) ;
183
- var overheadTime = overheadMeasurements . Average ( ) ;
184
-
185
- // Allow for 1 cpu cycle variance
186
- Assert . True ( overheadTime * cpuGhz < workloadTime * cpuGhz + 1 , "Overhead took more time than workload." ) ;
173
+ isZero = ZeroMeasurementHelper . CheckZeroMeasurementTwoSamples ( overheadMeasurements , workloadMeasurements ) ;
174
+ Assert . True ( isZero , "Overhead took more time than workload." ) ;
187
175
188
176
Assert . True ( ( report . GcStats . GetBytesAllocatedPerOperation ( report . BenchmarkCase ) ?? 0L ) == 0L , "Memory allocations measured above 0." ) ;
189
177
}
0 commit comments