summaryrefslogtreecommitdiff
path: root/tests/i915/sysfs_clients.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2021-01-24 09:50:22 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2021-01-24 10:08:19 +0000
commitceb5316d76561ae4135760d6990d4fd4b2739d91 (patch)
tree210cfc72a89ff11b304ec5ea81c4f0bd8260b351 /tests/i915/sysfs_clients.c
parenta4a27695572978b19a07aa7a7c0736764d3ef02e (diff)
i915/sysfs_clients: Tare the execution overhead
CI is not nearly as instantaneous as we would ideally like, and so we need to compensate for the delays in execution. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Acked-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Diffstat (limited to 'tests/i915/sysfs_clients.c')
-rw-r--r--tests/i915/sysfs_clients.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/tests/i915/sysfs_clients.c b/tests/i915/sysfs_clients.c
index 087efd69..6a7a6855 100644
--- a/tests/i915/sysfs_clients.c
+++ b/tests/i915/sysfs_clients.c
@@ -328,19 +328,22 @@ busy_one(int i915, int clients, const struct intel_execution_engine2 *e)
gem_context_clone_with_engines(i915, 0),
.engine = e->flags,
.flags = IGT_SPIN_POLL_RUN);
+ igt_spin_busywait_until_started(spin);
+ usleep(10); /* kick the tasklets */
+ /* Compensate for discrepancies in execution latencies */
+ idle = old = read_runtime(me, e->class);
igt_nsec_elapsed(memset(&tv, 0, sizeof(tv)));
- igt_spin_busywait_until_started(spin);
- old = 0;
for (int pass = 0; pass <= 10; pass++) {
usleep(1500 >> pass);
- delay = igt_nsec_elapsed(&tv);
+ delay = igt_nsec_elapsed(&tv) + idle;
igt_debug("delay: %'"PRIu64"ns\n", delay);
/* Check that we accumulate the runtime, while active */
active = read_runtime(me, e->class);
- igt_info("active1[%d]: %'"PRIu64"ns\n", pass, active);
+ igt_info("active1[%d]: %'"PRIu64"ns (%'"PRIu64"ns)\n",
+ pass, active, delay);
igt_assert(active > old); /* monotonic */
assert_within_epsilon(active, delay, 20);
@@ -366,17 +369,19 @@ busy_one(int i915, int clients, const struct intel_execution_engine2 *e)
spin->execbuf.rsvd1 = 0;
gem_execbuf(i915, &spin->execbuf);
igt_spin_busywait_until_started(spin);
- igt_nsec_elapsed(memset(&tv, 0, sizeof(tv)));
+ usleep(10); /* kick the tasklets */
+ igt_nsec_elapsed(memset(&tv, 0, sizeof(tv)));
+ idle = read_runtime(me, e->class);
for (int pass = 0; pass <= 10; pass++) {
usleep(1000 >> pass);
delay = igt_nsec_elapsed(&tv) + idle;
igt_debug("delay: %'"PRIu64"ns\n", delay);
- /* Check that we accumulate the runtime, while active */
active = read_runtime(me, e->class);
- igt_info("active0[%d]: %'"PRIu64"ns\n", pass, active);
- igt_assert(active > old); /* monotonic */
+ igt_info("active0[%d]: %'"PRIu64"ns (%'"PRIu64"ns)\n",
+ pass, active, delay);
+ igt_assert(active > old);
assert_within_epsilon(active, delay, 20);
old = active;