[Intel-gfx] [RFC 12/12] compare runtimes

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Mon Mar 9 18:31:29 UTC 2020


From: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
---
 drivers/gpu/drm/i915/gem/i915_gem_context.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index abf8c777041d..1c41079dcf17 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -264,13 +264,22 @@ static void free_engines_rcu(struct rcu_head *rcu)
 	/* Transfer accumulated runtime to the parent GEM context. */
 	for_each_gem_engine(ce, engines, it) {
 		unsigned int class = ce->engine->uabi_class;
+		u64 runtime[2];
 
 		GEM_BUG_ON(class >= ARRAY_SIZE(ctx->past_runtime));
-		atomic64_add(ce->runtime.total, &ctx->past_runtime[class]);
+		runtime[0] = ce->runtime.total;
+		atomic64_add(runtime[0], &ctx->past_runtime[class]);
+		runtime[0] *= RUNTIME_INFO(ctx->i915)->cs_timestamp_period_ns;
 
 		GEM_BUG_ON(class >= ARRAY_SIZE(ctx->past_sw_runtime));
-		atomic64_add(ktime_to_ns(intel_context_get_busy_time(ce)),
-			     &ctx->past_sw_runtime[class]);
+		runtime[1] = ktime_to_ns(intel_context_get_busy_time(ce));
+		atomic64_add(runtime[1], &ctx->past_sw_runtime[class]);
+
+		if (runtime[0] || runtime[1])
+			printk("%p class%u %llums vs %llums\n",
+			       ce, class,
+			       runtime[0] / 1000000,
+			       runtime[1] / 1000000);
 	}
 
 	i915_gem_context_put(ctx);
-- 
2.20.1



More information about the Intel-gfx mailing list