[PATCH v6 01/34] drm/i915: Add total count to context status debugfs output

John.C.Harrison
2016-04-20T17:13:58Z

When there are lots and lots and even more lots of contexts (e.g. when
running with execlists) it is useful to be able to immediately see
what the total context count is.

v4: Re-typed a variable (review feedback from Joonas)

For: VIZ-1587
Signed-off-by: John Harrison <John.C.Harrison@Intel.com>
Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
---
drivers/gpu/drm/i915/i915_debugfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c b/drivers/gpu/drm/i915/i915_debugfs.c
index 29ff1b3..e89781a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -1961,7 +1961,7 @@ static int i915_context_status(struct seq_file *m, void *unused)
struct intel_engine_cs *engine;
struct intel_context *ctx;
enum intel_engine_id id;
- int ret;
+ int ret, count = 0;

ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret)
@@ -1976,6 +1976,7 @@ static int i915_context_status(struct seq_file *m, void *unused)
describe_ctx(m, ctx);
if (ctx == dev_priv->kernel_context)
seq_printf(m, "(kernel context) ");
+ count++;

if (i915.enable_execlists) {
seq_putc(m, '\n');
@@ -1999,6 +2000,8 @@ static int i915_context_status(struct seq_file *m, void *unused)
seq_putc(m, '\n');
}

+ seq_printf(m, "Total: %d contexts\n", count);
+
mutex_unlock(&dev->struct_mutex);

return 0;