[PATCH i-g-t] gputop: Print message without clients
Lucas De Marchi
lucas.demarchi at intel.com
Thu Sep 12 16:06:09 UTC 2024
On Thu, Sep 12, 2024 at 05:24:59PM GMT, Kamil Konieczny wrote:
>Hi Lucas,
>On 2024-09-12 at 07:14:26 -0700, Lucas De Marchi wrote:
>> Devs are often confused why gputop doesn't display anything and think it
>> doesn't yet support the driver/platform. This is different from
>> intel_gpu_top that can display a header with engines, because in that
>> case there is a fixed set of engines and no variance according to the
>> driver.
>>
>> Print a message to give a hint that nothing is displayed because there's
>> nothing running.
>
>Could we diplay at least current power consumption and accumulated one?
but those are not supported in gputop yet, AFAIK. What igt functions
and/or kernel interfaces are you suggesting?
Lucas De Marchi
>
>It is only a suggestion, so
>Reviewed-by: Kamil Konieczny <kamil.konieczny at linux.intel.com>
>
>>
>> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
>> ---
>> tools/gputop.c | 14 ++++++++++++--
>> 1 file changed, 12 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/gputop.c b/tools/gputop.c
>> index 8842eebbd..43b01f566 100644
>> --- a/tools/gputop.c
>> +++ b/tools/gputop.c
>> @@ -39,6 +39,9 @@ enum utilization_type {
>>
>> static const char *bars[] = { " ", "▏", "▎", "▍", "▌", "▋", "▊", "▉", "█" };
>>
>> +#define ANSI_HEADER "\033[7m"
>> +#define ANSI_RESET "\033[0m"
>> +
>> static void n_spaces(const unsigned int n)
>> {
>> unsigned int i;
>> @@ -82,7 +85,7 @@ print_client_header(struct igt_drm_client *c, int lines, int con_w, int con_h,
>> if (lines++ >= con_h)
>> return lines;
>>
>> - printf("\033[7m");
>> + printf(ANSI_HEADER);
>> ret = printf("DRM minor %u", c->drm_minor);
>> n_spaces(con_w - ret);
>>
>> @@ -123,7 +126,7 @@ print_client_header(struct igt_drm_client *c, int lines, int con_w, int con_h,
>> }
>> }
>>
>> - printf(" %-*s\033[0m\n", con_w - len - 1, "NAME");
>> + printf(" %-*s" ANSI_RESET "\n", con_w - len - 1, "NAME");
>>
>> return lines;
>> }
>> @@ -447,6 +450,13 @@ int main(int argc, char **argv)
>> update_console_size(&con_w, &con_h);
>> clrscr();
>>
>> + if (!clients->num_clients) {
>> + const char *msg = " (No GPU clients yet. Start workload to see stats)";
>> +
>> + printf(ANSI_HEADER "%-*s" ANSI_RESET "\n",
>> + (int)(con_w - strlen(msg) - 1), msg);
>> + }
>> +
>> igt_for_each_drm_client(clients, c, i) {
>> assert(c->status != IGT_DRM_CLIENT_PROBE);
>> if (c->status != IGT_DRM_CLIENT_ALIVE)
>> --
>> 2.43.0
>>
More information about the igt-dev
mailing list