summaryrefslogtreecommitdiff
path: root/tests/i915/sysfs_clients.c
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2021-01-24 18:54:19 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2021-01-24 18:55:59 +0000
commit94647cd8315d63867f57f716380601bdf8595ee7 (patch)
tree9a81c33e94da2b5a0f94f92ddaa9b6b53bfc65a5 /tests/i915/sysfs_clients.c
parent32b697348f2687083a710ad240ff09aec3cb2088 (diff)
i915/sysfs_clients: Use the centre-point of read_runtime()
Compare the runtime against the centre of the read_runtime, to try and compensate for scheduling delays. 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.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/tests/i915/sysfs_clients.c b/tests/i915/sysfs_clients.c
index e3932af3..d4c92245 100644
--- a/tests/i915/sysfs_clients.c
+++ b/tests/i915/sysfs_clients.c
@@ -345,14 +345,16 @@ busy_one(int i915, int clients, const struct intel_execution_engine2 *e)
/* Compensate for discrepancies in execution latencies */
idle = old = read_runtime(me, e->class);
igt_nsec_elapsed(memset(&tv, 0, sizeof(tv)));
-
for (int pass = 0; pass <= 10; pass++) {
usleep(1500 >> pass);
- delay = igt_nsec_elapsed(&tv) + idle;
- igt_debug("delay: %'"PRIu64"ns\n", delay);
/* Check that we accumulate the runtime, while active */
+ delay = igt_nsec_elapsed(&tv);
active = read_runtime(me, e->class);
+ delay += igt_nsec_elapsed(&tv);
+ delay /= 2; /* use the centre point of the read_runtime() */
+ delay += idle; /* tare */
+
igt_info("active1[%d]: %'"PRIu64"ns (%'"PRIu64"ns)\n",
pass, active, delay);
igt_assert(active > old); /* monotonic */
@@ -400,14 +402,18 @@ busy_one(int i915, int clients, const struct intel_execution_engine2 *e)
igt_spin_busywait_until_started(spin);
usleep(10); /* kick the tasklets */
+ idle = old = read_runtime(me, e->class);
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 */
+ delay = igt_nsec_elapsed(&tv);
active = read_runtime(me, e->class);
+ delay += igt_nsec_elapsed(&tv);
+ delay /= 2; /* use the centre point of the read_runtime() */
+ delay += idle; /* tare */
+
igt_info("active0[%d]: %'"PRIu64"ns (%'"PRIu64"ns)\n",
pass, active, delay);
igt_assert(active > old);