On 07/09/2020 10:31, Petri Latvala wrote:
On Fri, Sep 04, 2020 at 02:06:07PM +0100, Tvrtko Ursulin wrote:
From: Tvrtko Ursulin <tvrtko.ursu...@intel.com>

Adds support for per-client engine busyness stats i915 exports in sysfs
and produces output like the below:

==========================================================================
intel-gpu-top -  935/ 935 MHz;    0% RC6; 14.73 Watts;     1097 irqs/s

       IMC reads:     1401 MiB/s
      IMC writes:        4 MiB/s

           ENGINE      BUSY                                 MI_SEMA MI_WAIT
      Render/3D/0   63.73% |███████████████████           |      3%      0%
        Blitter/0    9.53% |██▊                           |      6%      0%
          Video/0   39.32% |███████████▊                  |     16%      0%
          Video/1   15.62% |████▋                         |      0%      0%
   VideoEnhance/0    0.00% |                              |      0%      0%

   PID            NAME     RCS          BCS          VCS         VECS
  4084        gem_wsim |█████▌     ||█          ||           ||           |
  4086        gem_wsim |█▌         ||           ||███        ||           |
==========================================================================

Apart from the existing physical engine utilization it now also shows
utilization per client and per engine class.

v2:
  * Version to match removal of global enable_stats toggle.
  * Plus various fixes.

v3:
  * Support brief backward jumps in client stats.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursu...@intel.com>
---
  tools/intel_gpu_top.c | 539 +++++++++++++++++++++++++++++++++++++++++-
  1 file changed, 528 insertions(+), 11 deletions(-)

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index cae01c25b920..9eac569e75de 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -679,23 +679,347 @@ static void pmu_sample(struct engines *engines)
        }
  }
+enum client_status {
+       FREE = 0, /* mbz */
+       ALIVE,
+       PROBE
+};
+
+struct clients;
+
+struct client {
+       struct clients *clients;
+
+       enum client_status status;
+       unsigned int id;
+       unsigned int pid;
+       char name[128];
+       unsigned int samples;
+       unsigned long total;
+       struct engines *engines;
+       unsigned long *val;
+       uint64_t *last;
+};
+
+struct engine_class {
+       unsigned int class;
+       const char *name;
+       unsigned int num_engines;
+};
+
+struct clients {
+       unsigned int num_classes;
+       struct engine_class *class;
+
+       unsigned int num_clients;
+       struct client *client;
+};
+
+#define for_each_client(clients, c, tmp) \
+       for ((tmp) = (clients)->num_clients, c = (clients)->client; \
+            (tmp > 0); (tmp)--, (c)++)
+
+static struct clients *init_clients(void)
+{
+       struct clients *clients = malloc(sizeof(*clients));
+
+       return memset(clients, 0, sizeof(*clients));
+}
+
+#define SYSFS_CLIENTS "/sys/class/drm/card0/clients"

Now that intel_gpu_top supports device selection, this path works
every time only 60% of the time, right?

Gah yes.. thanks. I cherry picked from the wrong branch. I did already have this updated for device selection, somewhere. Will find it.

Regards,

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

Reply via email to