[PATCH i-g-t] gputop: Print message without clients

Kamil Konieczny kamil.konieczny at linux.intel.com
Fri Sep 13 16:52:05 UTC 2024


Hi Lucas,
On 2024-09-12 at 11:06:09 -0500, Lucas De Marchi wrote:
> 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
> 

I didn't have time for looking how/what to use,
just used intel_gpu_top -c and see:


Freq MHz req,Freq MHz act,IRQ /s,RC6 %,Power W gpu,Power W pkg,IMC MiB/s rd,IMC MiB/s wr,RCS %,RCS se,RCS wa,BCS %,BCS se,BCS wa,VCS %,VCS se,VCS wa,VECS %,VECS se,VECS wa
0.000000,0.000000,0.000000,99.993090,0.000000,4.020512,1051.870011,24.579949,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000
0.000000,0.000000,0.991862,100.000000,0.000000,0.656479,200.265345,3.654343,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000,0.000000
0.

The one interesting field is 'Power W gpu', I assume most drm/gpu
drivers have it? Next one is Freq MHz act.

Regards,
Kamil

> > 
> > 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