summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2018-08-15 12:14:27 +0100
committerChris Wilson <chris@chris-wilson.co.uk>2018-08-15 13:40:50 +0100
commit940cb5f46433a8ae48d21c6672e4d8ecd1358bbf (patch)
tree4e39f5f671367022a8a29cf762b7ab175bd9f7ca
parent9c0f04355107a8693650b16756b6343a78501138 (diff)
igt/gem_ctx_switch: Show the combined ctx-switch latency
Since we submit from several processes to the same engine for the forked tests, the total number of context switches is the sum of each process and needs to be combined together to compute the individual cs latency. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--tests/gem_ctx_switch.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/gem_ctx_switch.c b/tests/gem_ctx_switch.c
index 766ff9ae..1208cb8d 100644
--- a/tests/gem_ctx_switch.c
+++ b/tests/gem_ctx_switch.c
@@ -93,8 +93,15 @@ static void single(int fd, uint32_t handle,
struct drm_i915_gem_exec_object2 obj;
struct drm_i915_gem_relocation_entry reloc;
uint32_t contexts[64];
+ struct {
+ double elapsed;
+ unsigned long count;
+ } *shared;
int n;
+ shared = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED | MAP_ANON, -1, 0);
+ igt_assert(shared != MAP_FAILED);
+
gem_require_ring(fd, e->exec_id | e->flags);
for (n = 0; n < 64; n++)
@@ -158,11 +165,31 @@ static void single(int fd, uint32_t handle,
igt_info("[%d] %s: %'u cycles: %.3fus%s\n",
child, e->name, count, elapsed(&start, &now)*1e6 / count,
flags & INTERRUPTIBLE ? " (interruptible)" : "");
+
+ shared[child].elapsed = elapsed(&start, &now);
+ shared[child].count = count;
}
igt_waitchildren();
+ if (ncpus > 1) {
+ unsigned long total = 0;
+ double max = 0;
+
+ for (n = 0; n < ncpus; n++) {
+ total += shared[n].count;
+ if (shared[n].elapsed > max)
+ max = shared[n].elapsed;
+ }
+
+ igt_info("Total %s: %'lu cycles: %.3fus%s\n",
+ e->name, total, max*1e6 / total,
+ flags & INTERRUPTIBLE ? " (interruptible)" : "");
+ }
+
for (n = 0; n < 64; n++)
gem_context_destroy(fd, contexts[n]);
+
+ munmap(shared, 4096);
}
static void all(int fd, uint32_t handle, unsigned flags, int timeout)