diff options
author | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2018-02-12 11:35:38 +0000 |
---|---|---|
committer | Tvrtko Ursulin <tvrtko.ursulin@intel.com> | 2018-02-13 12:43:29 +0000 |
commit | cc60b8f09c8c190849f1d8ac8578e2053d356179 (patch) | |
tree | aaf9354cd0cb6534c070d3ceeb5bdd5b5e6c2452 /tests/perf_pmu.c | |
parent | bd022a12eb04d271f704e9b581131112245bd3dc (diff) |
tests/perf_pmu: Handle thermally throttled devices
Some systems cannot reach the advertised maximum frequency due throttling.
Handle them by considering a 100MHz lower limit.
v2: Use more relaxed tolerance only in the downward direction.
(Chris Wilson)
v3: Improved assert message. (Chris Wilson)
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Diffstat (limited to 'tests/perf_pmu.c')
-rw-r--r-- | tests/perf_pmu.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/tests/perf_pmu.c b/tests/perf_pmu.c index e912a93a..3f2fb911 100644 --- a/tests/perf_pmu.c +++ b/tests/perf_pmu.c @@ -126,11 +126,16 @@ static uint64_t pmu_read_multi(int fd, unsigned int num, uint64_t *val) return buf[1]; } +#define __assert_within_epsilon(x, ref, tol_up, tol_down) \ + igt_assert_f((double)(x) <= (1.0 + (tol_up)) * (double)(ref) && \ + (double)(x) >= (1.0 - (tol_down)) * (double)(ref), \ + "'%s' != '%s' (%f not within +%f%%/-%f%% tolerance of %f)\n",\ + #x, #ref, (double)(x), \ + (tol_up) * 100.0, (tol_down) * 100.0, \ + (double)(ref)) + #define assert_within_epsilon(x, ref, tolerance) \ - igt_assert_f((double)(x) <= (1.0 + (tolerance)) * (double)(ref) && \ - (double)(x) >= (1.0 - (tolerance)) * (double)(ref), \ - "'%s' != '%s' (%f not within %f%% tolerance of %f)\n",\ - #x, #ref, (double)(x), (tolerance) * 100.0, (double)(ref)) + __assert_within_epsilon(x, ref, tolerance, tolerance) /* * Helper for cases where we assert on time spent sleeping (directly or @@ -1235,8 +1240,13 @@ test_frequency(int gem_fd) min[0], min[1]); igt_info("Max frequency: requested %.1f, actual %.1f\n", max[0], max[1]); + assert_within_epsilon(min[0], min_freq, tolerance); - assert_within_epsilon(max[0], max_freq, tolerance); + /* + * On thermally throttled devices we cannot be sure maximum frequency + * can be reached so use larger tolerance downards. + */ + __assert_within_epsilon(max[0], max_freq, tolerance, 0.15f); } static bool wait_for_rc6(int fd) |