diff options
author | Andy Ayers <andya@microsoft.com> | 2016-04-11 16:52:45 -0700 |
---|---|---|
committer | Andy Ayers <andya@microsoft.com> | 2016-04-11 16:52:45 -0700 |
commit | fcfcec5e194b2a376b176d0de44dbea2d4ece79c (patch) | |
tree | 4bd65580d509dde3e8c634f89813ff88cfcf2ecd /tests | |
parent | e08912eecd2519467f0b73ffb2d03cfafb13a1df (diff) | |
parent | 73a947cde48114ef3989d84112d67b6a6f746c64 (diff) | |
download | coreclr-fcfcec5e194b2a376b176d0de44dbea2d4ece79c.tar.gz coreclr-fcfcec5e194b2a376b176d0de44dbea2d4ece79c.tar.bz2 coreclr-fcfcec5e194b2a376b176d0de44dbea2d4ece79c.zip |
Merge pull request #4272 from AndyAyersMS/FixSpectralNorm
Fix validation of spectralnorm under xunit-performance
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/JIT/Performance/CodeQuality/BenchmarksGame/spectralnorm/spectralnorm.cs | 18 |
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"); + } } } |