diff mbox series

[i-g-t,v2] intel_gpu_top: Hide unused clients

Message ID 20210201093123.3481855-1-chris@chris-wilson.co.uk (mailing list archive)
State New, archived
Headers show
Series [i-g-t,v2] intel_gpu_top: Hide unused clients | expand

Commit Message

Chris Wilson Feb. 1, 2021, 9:31 a.m. UTC
Hide inactive clients by pressing 'i' (toggle in interactive mode).

v2: Fix location of filter_idle.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
---
 tools/intel_gpu_top.c | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Tvrtko Ursulin Feb. 1, 2021, 9:53 a.m. UTC | #1
On 01/02/2021 09:31, Chris Wilson wrote:
> Hide inactive clients by pressing 'i' (toggle in interactive mode).
> 
> v2: Fix location of filter_idle.
> 
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> ---
>   tools/intel_gpu_top.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index 60ff62d28..d88b6cc61 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -1595,6 +1595,7 @@ print_imc(struct engines *engines, double t, int lines, int con_w, int con_h)
>   }
>   
>   static bool class_view;
> +static bool filter_idle;
>   
>   static int
>   print_engines_header(struct engines *engines, double t,
> @@ -2115,6 +2116,9 @@ static void process_stdin(unsigned int timeout_us)
>   		case 'q':
>   			stop_top = true;
>   			break;
> +		case 'i':
> +			filter_idle ^= true;
> +			break;
>   		case '1':
>   			class_view ^= true;
>   			break;
> @@ -2323,9 +2327,14 @@ int main(int argc, char **argv)
>   
>   				for_each_client(clients, c, j) {
>   					assert(c->status != PROBE);
> +
>   					if (c->status != ALIVE)
>   						break; /* Active clients are first in the array. */
>   
> +					/* Active clients before idle */
> +					if (filter_idle && !c->total_runtime)
> +						break;
> +

Break won't be correct for id sort. I don't see what did not work with 
v1? It should be effectively the same apart from the break.

Regards,

Tvrtko

>   					if (lines >= con_h)
>   						break;
>   
>
Chris Wilson Feb. 1, 2021, 9:57 a.m. UTC | #2
Quoting Tvrtko Ursulin (2021-02-01 09:53:20)
> 
> On 01/02/2021 09:31, Chris Wilson wrote:
> > Hide inactive clients by pressing 'i' (toggle in interactive mode).
> > 
> > v2: Fix location of filter_idle.
> > 
> > Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> > Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
> > ---
> >   tools/intel_gpu_top.c | 9 +++++++++
> >   1 file changed, 9 insertions(+)
> > 
> > diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> > index 60ff62d28..d88b6cc61 100644
> > --- a/tools/intel_gpu_top.c
> > +++ b/tools/intel_gpu_top.c
> > @@ -1595,6 +1595,7 @@ print_imc(struct engines *engines, double t, int lines, int con_w, int con_h)
> >   }
> >   
> >   static bool class_view;
> > +static bool filter_idle;
> >   
> >   static int
> >   print_engines_header(struct engines *engines, double t,
> > @@ -2115,6 +2116,9 @@ static void process_stdin(unsigned int timeout_us)
> >               case 'q':
> >                       stop_top = true;
> >                       break;
> > +             case 'i':
> > +                     filter_idle ^= true;
> > +                     break;
> >               case '1':
> >                       class_view ^= true;
> >                       break;
> > @@ -2323,9 +2327,14 @@ int main(int argc, char **argv)
> >   
> >                               for_each_client(clients, c, j) {
> >                                       assert(c->status != PROBE);
> > +
> >                                       if (c->status != ALIVE)
> >                                               break; /* Active clients are first in the array. */
> >   
> > +                                     /* Active clients before idle */
> > +                                     if (filter_idle && !c->total_runtime)
> > +                                             break;
> > +
> 
> Break won't be correct for id sort. I don't see what did not work with 
> v1? It should be effectively the same apart from the break.

We didn't the client to peek into.

Maybe you want to do v3 :)
-Chris
Tvrtko Ursulin Feb. 1, 2021, 10:05 a.m. UTC | #3
On 01/02/2021 09:57, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2021-02-01 09:53:20)
>>
>> On 01/02/2021 09:31, Chris Wilson wrote:
>>> Hide inactive clients by pressing 'i' (toggle in interactive mode).
>>>
>>> v2: Fix location of filter_idle.
>>>
>>> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
>>> Cc: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
>>> Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
>>> ---
>>>    tools/intel_gpu_top.c | 9 +++++++++
>>>    1 file changed, 9 insertions(+)
>>>
>>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>>> index 60ff62d28..d88b6cc61 100644
>>> --- a/tools/intel_gpu_top.c
>>> +++ b/tools/intel_gpu_top.c
>>> @@ -1595,6 +1595,7 @@ print_imc(struct engines *engines, double t, int lines, int con_w, int con_h)
>>>    }
>>>    
>>>    static bool class_view;
>>> +static bool filter_idle;
>>>    
>>>    static int
>>>    print_engines_header(struct engines *engines, double t,
>>> @@ -2115,6 +2116,9 @@ static void process_stdin(unsigned int timeout_us)
>>>                case 'q':
>>>                        stop_top = true;
>>>                        break;
>>> +             case 'i':
>>> +                     filter_idle ^= true;
>>> +                     break;
>>>                case '1':
>>>                        class_view ^= true;
>>>                        break;
>>> @@ -2323,9 +2327,14 @@ int main(int argc, char **argv)
>>>    
>>>                                for_each_client(clients, c, j) {
>>>                                        assert(c->status != PROBE);
>>> +
>>>                                        if (c->status != ALIVE)
>>>                                                break; /* Active clients are first in the array. */
>>>    
>>> +                                     /* Active clients before idle */
>>> +                                     if (filter_idle && !c->total_runtime)
>>> +                                             break;
>>> +
>>
>> Break won't be correct for id sort. I don't see what did not work with
>> v1? It should be effectively the same apart from the break.
> 
> We didn't the client to peek into.

Ahaha did not spot you put the diff in wrong function. :)

> Maybe you want to do v3 :)

Sure.

Regards,

Tvrtko
diff mbox series

Patch

diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 60ff62d28..d88b6cc61 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -1595,6 +1595,7 @@  print_imc(struct engines *engines, double t, int lines, int con_w, int con_h)
 }
 
 static bool class_view;
+static bool filter_idle;
 
 static int
 print_engines_header(struct engines *engines, double t,
@@ -2115,6 +2116,9 @@  static void process_stdin(unsigned int timeout_us)
 		case 'q':
 			stop_top = true;
 			break;
+		case 'i':
+			filter_idle ^= true;
+			break;
 		case '1':
 			class_view ^= true;
 			break;
@@ -2323,9 +2327,14 @@  int main(int argc, char **argv)
 
 				for_each_client(clients, c, j) {
 					assert(c->status != PROBE);
+
 					if (c->status != ALIVE)
 						break; /* Active clients are first in the array. */
 
+					/* Active clients before idle */
+					if (filter_idle && !c->total_runtime)
+						break;
+
 					if (lines >= con_h)
 						break;