diff options
author | Robert Bragg <robert@sixbynine.org> | 2017-02-06 17:04:14 +0000 |
---|---|---|
committer | Lionel Landwerlin <lionel.g.landwerlin@intel.com> | 2017-08-04 12:02:04 +0100 |
commit | 6d4e853b87098925da2f7e4416b44a4f41390c6f (patch) | |
tree | 27660d343cf7bbd79b40b1f919d2fc2055cd76ad /tests/perf.c | |
parent | ac62f4ae17b0c5ed564cb32f769ff53109a137fc (diff) |
tests/perf: allow 10% margin matching oa/sysfs freq in test_oa_exponents
Signed-off-by: Robert Bragg <robert@sixbynine.org>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Diffstat (limited to 'tests/perf.c')
-rw-r--r-- | tests/perf.c | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/tests/perf.c b/tests/perf.c index d47e45c8..c8092eaa 100644 --- a/tests/perf.c +++ b/tests/perf.c @@ -1111,6 +1111,8 @@ test_oa_formats(void) static void test_oa_exponents(int gt_freq_mhz) { + uint32_t freq_margin; + /* This test tries to use the sysfs interface for pinning the GT * frequency so we have another point of reference for comparing with * the clock frequency as derived from OA reports. @@ -1129,11 +1131,17 @@ test_oa_exponents(int gt_freq_mhz) igt_debug("Testing OA timer exponents with requested GT frequency = %dmhz\n", gt_freq_mhz); + /* allow a +- 10% error margin when checking that the frequency + * calculated from the OA reports matches the frequency according to + * sysfs. + */ + freq_margin = gt_freq_mhz * 0.1; + /* It's asking a lot to sample with a 160 nanosecond period and the * test can fail due to buffer overflows if it wasn't possible to * keep up, so we don't start from an exponent of zero... */ - for (int i = 2; i < 20; i++) { + for (int i = 5; i < 20; i++) { uint32_t expected_timestamp_delta; uint32_t timestamp_delta; uint32_t oa_report0[64]; @@ -1157,8 +1165,10 @@ test_oa_exponents(int gt_freq_mhz) gt_freq_mhz_0 = sysfs_read("gt_act_freq_mhz"); - igt_debug("ITER %d: testing OA exponent %d with sysfs GT freq = %dmhz\n", - j, i, gt_freq_mhz_0); + igt_debug("ITER %d: testing OA exponent %d (period = %"PRIu64"ns) with sysfs GT freq = %dmhz +- %u\n", + j, i, + oa_exponent_to_ns(i), + gt_freq_mhz_0, freq_margin); open_and_read_2_oa_reports(test_oa_format, i, /* exponent */ @@ -1199,7 +1209,8 @@ test_oa_exponents(int gt_freq_mhz) igt_debug("ITER %d: time delta = %"PRIu32"(ns) clock delta = %"PRIu32" freq = %"PRIu32"(mhz)\n", j, time_delta, clock_delta, freq); - if (freq == gt_freq_mhz_1) + if (freq < (gt_freq_mhz_1 + freq_margin) && + freq > (gt_freq_mhz_1 - freq_margin)) n_freq_matches++; n_tested++; |