Commit fe9cf277 authored by Chris Wilson's avatar Chris Wilson 🤔

igt/perf_pmu: Protect macro args

In particular we fix the evaluation of "(double)x" when x is a compound.
Signed-off-by: Chris Wilson's avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Reviewed-by: Tvrtko Ursulin's avatarTvrtko Ursulin <tvrtko.ursulin@intel.com>
parent 6de721fe
......@@ -99,10 +99,10 @@ static void pmu_read_multi(int fd, unsigned int num, uint64_t *val)
}
#define assert_within_epsilon(x, ref, tolerance) \
igt_assert_f((double)(x) <= (1.0 + tolerance) * (double)ref && \
(double)(x) >= (1.0 - tolerance) * (double)ref, \
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)
#x, #ref, (double)(x), (tolerance) * 100.0, (double)ref)
/*
* Helper for cases where we assert on time spent sleeping (directly or
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment