summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Performance/CodeQuality
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-04-11 14:21:56 -0700
committerAndy Ayers <andya@microsoft.com>2016-04-11 14:21:56 -0700
commit73a947cde48114ef3989d84112d67b6a6f746c64 (patch)
treedce17cff1ae16c24c32f943520104a16154727de /tests/src/JIT/Performance/CodeQuality
parente1f4da0039a82fa0ee11812f8676019fee0989ad (diff)
downloadcoreclr-73a947cde48114ef3989d84112d67b6a6f746c64.tar.gz
coreclr-73a947cde48114ef3989d84112d67b6a6f746c64.tar.bz2
coreclr-73a947cde48114ef3989d84112d67b6a6f746c64.zip
Fix validation of spectralnorm under xunit-performance
The valiation code wasn't correctly for the iteration strategy used by xunit-performance. Closes #4270.
Diffstat (limited to 'tests/src/JIT/Performance/CodeQuality')
-rw-r--r--tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs18
1 files changed, 10 insertions, 8 deletions
diff --git a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs
index fa2ac089ad..9e984864a7 100644
--- a/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs
+++ b/tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs
@@ -38,9 +38,10 @@ public class SpectralNorm
public static void Bench()
{
int n = 100;
- double a = 0;
foreach (var iteration in Benchmark.Iterations)
{
+ double a = 0;
+
using (iteration.StartMeasurement())
{
for (int i = 0; i < Iterations; i++)
@@ -49,13 +50,14 @@ public class SpectralNorm
a += s.Approximate(n);
}
}
- }
- double norm = a / (n * Iterations);
- double expected = 1.274219991;
- bool valid = Math.Abs(norm - expected) < 1e-4;
- if (!valid)
- {
- throw new Exception("Benchmark failed to validate");
+
+ double norm = a / Iterations;
+ double expected = 1.274219991;
+ bool valid = Math.Abs(norm - expected) < 1e-4;
+ if (!valid)
+ {
+ throw new Exception("Benchmark failed to validate");
+ }
}
}