Distinguish between the latency required to switch away from the
pollable spinner into the target nops from the client wakeup of
synchronisation on the last nop.

Signed-off-by: Chris Wilson <ch...@chris-wilson.co.uk>
---
 tests/gem_sync.c | 33 ++++++++++++++++++++++++++++++---
 1 file changed, 30 insertions(+), 3 deletions(-)

diff --git a/tests/gem_sync.c b/tests/gem_sync.c
index 5901e1476..a3e3d7ee8 100644
--- a/tests/gem_sync.c
+++ b/tests/gem_sync.c
@@ -207,7 +207,7 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
                const uint32_t bbe = MI_BATCH_BUFFER_END;
                struct drm_i915_gem_exec_object2 object;
                struct drm_i915_gem_execbuffer2 execbuf;
-               double end, this, elapsed, now;
+               double end, this, elapsed, now, baseline;
                unsigned long cycles;
                uint32_t cmd;
                igt_spin_t *spin;
@@ -230,6 +230,32 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
                igt_spin_batch_end(spin);
                gem_sync(fd, object.handle);
 
+               for (int warmup = 0; warmup <= 1; warmup++) {
+                       end = gettime() + timeout/10.;
+                       elapsed = 0;
+                       cycles = 0;
+                       do {
+                               *spin->batch = cmd;
+                               *spin->running = 0;
+                               gem_execbuf(fd, &spin->execbuf);
+                               while (!READ_ONCE(*spin->running))
+                                       ;
+
+                               this = gettime();
+                               igt_spin_batch_end(spin);
+                               gem_sync(fd, spin->handle);
+                               now = gettime();
+
+                               elapsed += now - this;
+                               cycles++;
+                       } while (now < end);
+                       baseline = elapsed / cycles;
+               }
+               igt_info("%s%sasline %ld cycles: %.3f us\n",
+                        names[child % num_engines] ?: "",
+                        names[child % num_engines] ? " b" : "B",
+                        cycles, elapsed*1e6/cycles);
+
                end = gettime() + timeout;
                elapsed = 0;
                cycles = 0;
@@ -251,11 +277,12 @@ wakeup_ring(int fd, unsigned ring, int timeout, int wlen)
                        elapsed += now - this;
                        cycles++;
                } while (now < end);
+               elapsed -= cycles * baseline;
 
-               igt_info("%s%sompleted %ld cycles: %.3f us\n",
+               igt_info("%s%sompleted %ld cycles: %.3f + %.3f us\n",
                         names[child % num_engines] ?: "",
                         names[child % num_engines] ? " c" : "C",
-                        cycles, elapsed*1e6/cycles);
+                        cycles, 1e6*baseline, elapsed*1e6/cycles);
 
                igt_spin_batch_free(fd, spin);
                gem_close(fd, object.handle);
-- 
2.18.0.rc2

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to