* [Intel-gfx] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes
@ 2021-02-03 11:44 ` Tvrtko Ursulin
0 siblings, 0 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2021-02-03 11:44 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
It is useful to let the user know what is the currently active sort mode.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tools/intel_gpu_top.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 584aa21b198a..b409106f3718 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -1479,6 +1479,8 @@ print_header_token(const char *cont, int lines, int con_w, int con_h, int *rem,
return lines;
}
+static const char *header_msg;
+
static int
print_header(const struct igt_device_card *card,
const char *codename,
@@ -1593,8 +1595,14 @@ print_header(const struct igt_device_card *card,
if (lines++ < con_h)
printf("\n");
- if (lines++ < con_h)
- printf("\n");
+ if (lines++ < con_h) {
+ if (header_msg) {
+ printf(" >>> %s\n", header_msg);
+ header_msg = NULL;
+ } else {
+ printf("\n");
+ }
+ }
}
return lines;
@@ -2146,12 +2154,15 @@ static void select_client_sort(void)
switch (++client_sort % 3) {
case 0:
client_cmp = client_last_cmp;
+ header_msg = "Sorting clients by current GPU usage.";
break;
case 1:
client_cmp = client_total_cmp;
+ header_msg = "Sorting clients by accummulated GPU usage.";
break;
case 2:
client_cmp = client_id_cmp;
+ header_msg = "Sorting clients by sysfs id.";
}
}
--
2.27.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes
@ 2021-02-03 11:44 ` Tvrtko Ursulin
0 siblings, 0 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2021-02-03 11:44 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
It is useful to let the user know what is the currently active sort mode.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
tools/intel_gpu_top.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index 584aa21b198a..b409106f3718 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -1479,6 +1479,8 @@ print_header_token(const char *cont, int lines, int con_w, int con_h, int *rem,
return lines;
}
+static const char *header_msg;
+
static int
print_header(const struct igt_device_card *card,
const char *codename,
@@ -1593,8 +1595,14 @@ print_header(const struct igt_device_card *card,
if (lines++ < con_h)
printf("\n");
- if (lines++ < con_h)
- printf("\n");
+ if (lines++ < con_h) {
+ if (header_msg) {
+ printf(" >>> %s\n", header_msg);
+ header_msg = NULL;
+ } else {
+ printf("\n");
+ }
+ }
}
return lines;
@@ -2146,12 +2154,15 @@ static void select_client_sort(void)
switch (++client_sort % 3) {
case 0:
client_cmp = client_last_cmp;
+ header_msg = "Sorting clients by current GPU usage.";
break;
case 1:
client_cmp = client_total_cmp;
+ header_msg = "Sorting clients by accummulated GPU usage.";
break;
case 2:
client_cmp = client_id_cmp;
+ header_msg = "Sorting clients by sysfs id.";
}
}
--
2.27.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [Intel-gfx] [PATCH i-g-t 2/2] intel_gpu_top: Add option to sort by PID
2021-02-03 11:44 ` [igt-dev] " Tvrtko Ursulin
@ 2021-02-03 11:44 ` Tvrtko Ursulin
-1 siblings, 0 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2021-02-03 11:44 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Useful to mimick top view.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
man/intel_gpu_top.rst | 2 +-
tools/intel_gpu_top.c | 46 +++++++++++++++++++++++++++++++------------
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst
index 118d8b953a70..b145d85c0440 100644
--- a/man/intel_gpu_top.rst
+++ b/man/intel_gpu_top.rst
@@ -56,7 +56,7 @@ Supported keys:
'q' Exit from the tool.
'1' Toggle between aggregated engine class and physical engine mode.
'n' Toggle display of numeric client busyness overlay.
- 's' Toggle between sort modes (runtime, total runtime, client id).
+ 's' Toggle between sort modes (runtime, total runtime, pid, client id).
'i' Toggle display of clients which used no GPU time.
DEVICE SELECTION
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index b409106f3718..24a87d2f4f3f 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -959,6 +959,24 @@ static int client_id_cmp(const void *_a, const void *_b)
return (int)b->id - a->id;
}
+static int client_pid_cmp(const void *_a, const void *_b)
+{
+ const struct client *a = _a;
+ const struct client *b = _b;
+ int pid_a, pid_b;
+
+ pid_a = a->status == ALIVE ? a->pid : INT_MAX;
+ pid_b = b->status == ALIVE ? b->pid : INT_MAX;
+
+ pid_b -= pid_a;
+ if (pid_b > 0)
+ return -1;
+ if (pid_b < 0)
+ return 1;
+
+ return (int)a->id - b->id;
+}
+
static int (*client_cmp)(const void *, const void *) = client_last_cmp;
static void sort_clients(struct clients *clients)
@@ -2149,21 +2167,23 @@ static void interactive_stdin(void)
static void select_client_sort(void)
{
+ struct {
+ int (*cmp)(const void *, const void *);
+ const char *msg;
+ } cmp[] = {
+ { client_last_cmp, "Sorting clients by current GPU usage." },
+ { client_total_cmp, "Sorting clients by accummulated GPU usage." },
+ { client_pid_cmp, "Sorting clients by pid." },
+ { client_id_cmp, "Sorting clients by sysfs id." },
+ };
static unsigned int client_sort;
- switch (++client_sort % 3) {
- case 0:
- client_cmp = client_last_cmp;
- header_msg = "Sorting clients by current GPU usage.";
- break;
- case 1:
- client_cmp = client_total_cmp;
- header_msg = "Sorting clients by accummulated GPU usage.";
- break;
- case 2:
- client_cmp = client_id_cmp;
- header_msg = "Sorting clients by sysfs id.";
- }
+ ++client_sort;
+ if (client_sort >= ARRAY_SIZE(cmp))
+ client_sort = 0;
+
+ client_cmp = cmp[client_sort].cmp;
+ header_msg = cmp[client_sort].msg;
}
static void process_stdin(unsigned int timeout_us)
--
2.27.0
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [igt-dev] [PATCH i-g-t 2/2] intel_gpu_top: Add option to sort by PID
@ 2021-02-03 11:44 ` Tvrtko Ursulin
0 siblings, 0 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2021-02-03 11:44 UTC (permalink / raw)
To: igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Useful to mimick top view.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
man/intel_gpu_top.rst | 2 +-
tools/intel_gpu_top.c | 46 +++++++++++++++++++++++++++++++------------
2 files changed, 34 insertions(+), 14 deletions(-)
diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst
index 118d8b953a70..b145d85c0440 100644
--- a/man/intel_gpu_top.rst
+++ b/man/intel_gpu_top.rst
@@ -56,7 +56,7 @@ Supported keys:
'q' Exit from the tool.
'1' Toggle between aggregated engine class and physical engine mode.
'n' Toggle display of numeric client busyness overlay.
- 's' Toggle between sort modes (runtime, total runtime, client id).
+ 's' Toggle between sort modes (runtime, total runtime, pid, client id).
'i' Toggle display of clients which used no GPU time.
DEVICE SELECTION
diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
index b409106f3718..24a87d2f4f3f 100644
--- a/tools/intel_gpu_top.c
+++ b/tools/intel_gpu_top.c
@@ -959,6 +959,24 @@ static int client_id_cmp(const void *_a, const void *_b)
return (int)b->id - a->id;
}
+static int client_pid_cmp(const void *_a, const void *_b)
+{
+ const struct client *a = _a;
+ const struct client *b = _b;
+ int pid_a, pid_b;
+
+ pid_a = a->status == ALIVE ? a->pid : INT_MAX;
+ pid_b = b->status == ALIVE ? b->pid : INT_MAX;
+
+ pid_b -= pid_a;
+ if (pid_b > 0)
+ return -1;
+ if (pid_b < 0)
+ return 1;
+
+ return (int)a->id - b->id;
+}
+
static int (*client_cmp)(const void *, const void *) = client_last_cmp;
static void sort_clients(struct clients *clients)
@@ -2149,21 +2167,23 @@ static void interactive_stdin(void)
static void select_client_sort(void)
{
+ struct {
+ int (*cmp)(const void *, const void *);
+ const char *msg;
+ } cmp[] = {
+ { client_last_cmp, "Sorting clients by current GPU usage." },
+ { client_total_cmp, "Sorting clients by accummulated GPU usage." },
+ { client_pid_cmp, "Sorting clients by pid." },
+ { client_id_cmp, "Sorting clients by sysfs id." },
+ };
static unsigned int client_sort;
- switch (++client_sort % 3) {
- case 0:
- client_cmp = client_last_cmp;
- header_msg = "Sorting clients by current GPU usage.";
- break;
- case 1:
- client_cmp = client_total_cmp;
- header_msg = "Sorting clients by accummulated GPU usage.";
- break;
- case 2:
- client_cmp = client_id_cmp;
- header_msg = "Sorting clients by sysfs id.";
- }
+ ++client_sort;
+ if (client_sort >= ARRAY_SIZE(cmp))
+ client_sort = 0;
+
+ client_cmp = cmp[client_sort].cmp;
+ header_msg = cmp[client_sort].msg;
}
static void process_stdin(unsigned int timeout_us)
--
2.27.0
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes
2021-02-03 11:44 ` [igt-dev] " Tvrtko Ursulin
@ 2021-02-03 11:47 ` Chris Wilson
-1 siblings, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2021-02-03 11:47 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx
Quoting Tvrtko Ursulin (2021-02-03 11:44:55)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> It is useful to let the user know what is the currently active sort mode.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tools/intel_gpu_top.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index 584aa21b198a..b409106f3718 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -1479,6 +1479,8 @@ print_header_token(const char *cont, int lines, int con_w, int con_h, int *rem,
> return lines;
> }
>
> +static const char *header_msg;
> +
> static int
> print_header(const struct igt_device_card *card,
> const char *codename,
> @@ -1593,8 +1595,14 @@ print_header(const struct igt_device_card *card,
> if (lines++ < con_h)
> printf("\n");
>
> - if (lines++ < con_h)
> - printf("\n");
> + if (lines++ < con_h) {
> + if (header_msg) {
> + printf(" >>> %s\n", header_msg);
> + header_msg = NULL;
I was just about to ask if we showed it once, then cleared it 1s later.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> + } else {
> + printf("\n");
> + }
> + }
> }
>
> return lines;
> @@ -2146,12 +2154,15 @@ static void select_client_sort(void)
> switch (++client_sort % 3) {
> case 0:
> client_cmp = client_last_cmp;
> + header_msg = "Sorting clients by current GPU usage.";
> break;
> case 1:
> client_cmp = client_total_cmp;
> + header_msg = "Sorting clients by accummulated GPU usage.";
> break;
> case 2:
> client_cmp = client_id_cmp;
> + header_msg = "Sorting clients by sysfs id.";
Do we care about "sysfs"? Just "Sorting clients by id."?
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes
@ 2021-02-03 11:47 ` Chris Wilson
0 siblings, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2021-02-03 11:47 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
Quoting Tvrtko Ursulin (2021-02-03 11:44:55)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> It is useful to let the user know what is the currently active sort mode.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> tools/intel_gpu_top.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index 584aa21b198a..b409106f3718 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -1479,6 +1479,8 @@ print_header_token(const char *cont, int lines, int con_w, int con_h, int *rem,
> return lines;
> }
>
> +static const char *header_msg;
> +
> static int
> print_header(const struct igt_device_card *card,
> const char *codename,
> @@ -1593,8 +1595,14 @@ print_header(const struct igt_device_card *card,
> if (lines++ < con_h)
> printf("\n");
>
> - if (lines++ < con_h)
> - printf("\n");
> + if (lines++ < con_h) {
> + if (header_msg) {
> + printf(" >>> %s\n", header_msg);
> + header_msg = NULL;
I was just about to ask if we showed it once, then cleared it 1s later.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
> + } else {
> + printf("\n");
> + }
> + }
> }
>
> return lines;
> @@ -2146,12 +2154,15 @@ static void select_client_sort(void)
> switch (++client_sort % 3) {
> case 0:
> client_cmp = client_last_cmp;
> + header_msg = "Sorting clients by current GPU usage.";
> break;
> case 1:
> client_cmp = client_total_cmp;
> + header_msg = "Sorting clients by accummulated GPU usage.";
> break;
> case 2:
> client_cmp = client_id_cmp;
> + header_msg = "Sorting clients by sysfs id.";
Do we care about "sysfs"? Just "Sorting clients by id."?
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes
2021-02-03 11:47 ` Chris Wilson
@ 2021-02-03 11:49 ` Tvrtko Ursulin
-1 siblings, 0 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2021-02-03 11:49 UTC (permalink / raw)
To: Chris Wilson, igt-dev; +Cc: Intel-gfx
On 03/02/2021 11:47, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2021-02-03 11:44:55)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> It is useful to let the user know what is the currently active sort mode.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>> tools/intel_gpu_top.c | 15 +++++++++++++--
>> 1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>> index 584aa21b198a..b409106f3718 100644
>> --- a/tools/intel_gpu_top.c
>> +++ b/tools/intel_gpu_top.c
>> @@ -1479,6 +1479,8 @@ print_header_token(const char *cont, int lines, int con_w, int con_h, int *rem,
>> return lines;
>> }
>>
>> +static const char *header_msg;
>> +
>> static int
>> print_header(const struct igt_device_card *card,
>> const char *codename,
>> @@ -1593,8 +1595,14 @@ print_header(const struct igt_device_card *card,
>> if (lines++ < con_h)
>> printf("\n");
>>
>> - if (lines++ < con_h)
>> - printf("\n");
>> + if (lines++ < con_h) {
>> + if (header_msg) {
>> + printf(" >>> %s\n", header_msg);
>> + header_msg = NULL;
>
> I was just about to ask if we showed it once, then cleared it 1s later.
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
>
>> + } else {
>> + printf("\n");
>> + }
>> + }
>> }
>>
>> return lines;
>> @@ -2146,12 +2154,15 @@ static void select_client_sort(void)
>> switch (++client_sort % 3) {
>> case 0:
>> client_cmp = client_last_cmp;
>> + header_msg = "Sorting clients by current GPU usage.";
>> break;
>> case 1:
>> client_cmp = client_total_cmp;
>> + header_msg = "Sorting clients by accummulated GPU usage.";
>> break;
>> case 2:
>> client_cmp = client_id_cmp;
>> + header_msg = "Sorting clients by sysfs id.";
>
> Do we care about "sysfs"? Just "Sorting clients by id."?
I was even doubting if having this sort is justified at all. Drop after
next patch (pid sort)?
Regards,
Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes
@ 2021-02-03 11:49 ` Tvrtko Ursulin
0 siblings, 0 replies; 11+ messages in thread
From: Tvrtko Ursulin @ 2021-02-03 11:49 UTC (permalink / raw)
To: Chris Wilson, igt-dev; +Cc: Intel-gfx, Tvrtko Ursulin
On 03/02/2021 11:47, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2021-02-03 11:44:55)
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> It is useful to let the user know what is the currently active sort mode.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>> ---
>> tools/intel_gpu_top.c | 15 +++++++++++++--
>> 1 file changed, 13 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>> index 584aa21b198a..b409106f3718 100644
>> --- a/tools/intel_gpu_top.c
>> +++ b/tools/intel_gpu_top.c
>> @@ -1479,6 +1479,8 @@ print_header_token(const char *cont, int lines, int con_w, int con_h, int *rem,
>> return lines;
>> }
>>
>> +static const char *header_msg;
>> +
>> static int
>> print_header(const struct igt_device_card *card,
>> const char *codename,
>> @@ -1593,8 +1595,14 @@ print_header(const struct igt_device_card *card,
>> if (lines++ < con_h)
>> printf("\n");
>>
>> - if (lines++ < con_h)
>> - printf("\n");
>> + if (lines++ < con_h) {
>> + if (header_msg) {
>> + printf(" >>> %s\n", header_msg);
>> + header_msg = NULL;
>
> I was just about to ask if we showed it once, then cleared it 1s later.
> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
>
>> + } else {
>> + printf("\n");
>> + }
>> + }
>> }
>>
>> return lines;
>> @@ -2146,12 +2154,15 @@ static void select_client_sort(void)
>> switch (++client_sort % 3) {
>> case 0:
>> client_cmp = client_last_cmp;
>> + header_msg = "Sorting clients by current GPU usage.";
>> break;
>> case 1:
>> client_cmp = client_total_cmp;
>> + header_msg = "Sorting clients by accummulated GPU usage.";
>> break;
>> case 2:
>> client_cmp = client_id_cmp;
>> + header_msg = "Sorting clients by sysfs id.";
>
> Do we care about "sysfs"? Just "Sorting clients by id."?
I was even doubting if having this sort is justified at all. Drop after
next patch (pid sort)?
Regards,
Tvrtko
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [Intel-gfx] [PATCH i-g-t 2/2] intel_gpu_top: Add option to sort by PID
2021-02-03 11:44 ` [igt-dev] " Tvrtko Ursulin
@ 2021-02-03 11:50 ` Chris Wilson
-1 siblings, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2021-02-03 11:50 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx
Quoting Tvrtko Ursulin (2021-02-03 11:44:56)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Useful to mimick top view.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> man/intel_gpu_top.rst | 2 +-
> tools/intel_gpu_top.c | 46 +++++++++++++++++++++++++++++++------------
> 2 files changed, 34 insertions(+), 14 deletions(-)
>
> diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst
> index 118d8b953a70..b145d85c0440 100644
> --- a/man/intel_gpu_top.rst
> +++ b/man/intel_gpu_top.rst
> @@ -56,7 +56,7 @@ Supported keys:
> 'q' Exit from the tool.
> '1' Toggle between aggregated engine class and physical engine mode.
> 'n' Toggle display of numeric client busyness overlay.
> - 's' Toggle between sort modes (runtime, total runtime, client id).
> + 's' Toggle between sort modes (runtime, total runtime, pid, client id).
> 'i' Toggle display of clients which used no GPU time.
>
> DEVICE SELECTION
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index b409106f3718..24a87d2f4f3f 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -959,6 +959,24 @@ static int client_id_cmp(const void *_a, const void *_b)
> return (int)b->id - a->id;
> }
>
> +static int client_pid_cmp(const void *_a, const void *_b)
> +{
> + const struct client *a = _a;
> + const struct client *b = _b;
> + int pid_a, pid_b;
> +
> + pid_a = a->status == ALIVE ? a->pid : INT_MAX;
> + pid_b = b->status == ALIVE ? b->pid : INT_MAX;
> +
> + pid_b -= pid_a;
> + if (pid_b > 0)
> + return -1;
> + if (pid_b < 0)
> + return 1;
> +
> + return (int)a->id - b->id;
> +}
> +
> static int (*client_cmp)(const void *, const void *) = client_last_cmp;
>
> static void sort_clients(struct clients *clients)
> @@ -2149,21 +2167,23 @@ static void interactive_stdin(void)
>
> static void select_client_sort(void)
> {
> + struct {
> + int (*cmp)(const void *, const void *);
> + const char *msg;
> + } cmp[] = {
> + { client_last_cmp, "Sorting clients by current GPU usage." },
> + { client_total_cmp, "Sorting clients by accummulated GPU usage." },
> + { client_pid_cmp, "Sorting clients by pid." },
> + { client_id_cmp, "Sorting clients by sysfs id." },
> + };
> static unsigned int client_sort;
>
> - switch (++client_sort % 3) {
> - case 0:
> - client_cmp = client_last_cmp;
> - header_msg = "Sorting clients by current GPU usage.";
> - break;
> - case 1:
> - client_cmp = client_total_cmp;
> - header_msg = "Sorting clients by accummulated GPU usage.";
> - break;
> - case 2:
> - client_cmp = client_id_cmp;
> - header_msg = "Sorting clients by sysfs id.";
> - }
> + ++client_sort;
> + if (client_sort >= ARRAY_SIZE(cmp))
> + client_sort = 0;
> +
> + client_cmp = cmp[client_sort].cmp;
> + header_msg = cmp[client_sort].msg;
> }
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 2/2] intel_gpu_top: Add option to sort by PID
@ 2021-02-03 11:50 ` Chris Wilson
0 siblings, 0 replies; 11+ messages in thread
From: Chris Wilson @ 2021-02-03 11:50 UTC (permalink / raw)
To: Tvrtko Ursulin, igt-dev; +Cc: Intel-gfx
Quoting Tvrtko Ursulin (2021-02-03 11:44:56)
> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>
> Useful to mimick top view.
>
> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> ---
> man/intel_gpu_top.rst | 2 +-
> tools/intel_gpu_top.c | 46 +++++++++++++++++++++++++++++++------------
> 2 files changed, 34 insertions(+), 14 deletions(-)
>
> diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst
> index 118d8b953a70..b145d85c0440 100644
> --- a/man/intel_gpu_top.rst
> +++ b/man/intel_gpu_top.rst
> @@ -56,7 +56,7 @@ Supported keys:
> 'q' Exit from the tool.
> '1' Toggle between aggregated engine class and physical engine mode.
> 'n' Toggle display of numeric client busyness overlay.
> - 's' Toggle between sort modes (runtime, total runtime, client id).
> + 's' Toggle between sort modes (runtime, total runtime, pid, client id).
> 'i' Toggle display of clients which used no GPU time.
>
> DEVICE SELECTION
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index b409106f3718..24a87d2f4f3f 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -959,6 +959,24 @@ static int client_id_cmp(const void *_a, const void *_b)
> return (int)b->id - a->id;
> }
>
> +static int client_pid_cmp(const void *_a, const void *_b)
> +{
> + const struct client *a = _a;
> + const struct client *b = _b;
> + int pid_a, pid_b;
> +
> + pid_a = a->status == ALIVE ? a->pid : INT_MAX;
> + pid_b = b->status == ALIVE ? b->pid : INT_MAX;
> +
> + pid_b -= pid_a;
> + if (pid_b > 0)
> + return -1;
> + if (pid_b < 0)
> + return 1;
> +
> + return (int)a->id - b->id;
> +}
> +
> static int (*client_cmp)(const void *, const void *) = client_last_cmp;
>
> static void sort_clients(struct clients *clients)
> @@ -2149,21 +2167,23 @@ static void interactive_stdin(void)
>
> static void select_client_sort(void)
> {
> + struct {
> + int (*cmp)(const void *, const void *);
> + const char *msg;
> + } cmp[] = {
> + { client_last_cmp, "Sorting clients by current GPU usage." },
> + { client_total_cmp, "Sorting clients by accummulated GPU usage." },
> + { client_pid_cmp, "Sorting clients by pid." },
> + { client_id_cmp, "Sorting clients by sysfs id." },
> + };
> static unsigned int client_sort;
>
> - switch (++client_sort % 3) {
> - case 0:
> - client_cmp = client_last_cmp;
> - header_msg = "Sorting clients by current GPU usage.";
> - break;
> - case 1:
> - client_cmp = client_total_cmp;
> - header_msg = "Sorting clients by accummulated GPU usage.";
> - break;
> - case 2:
> - client_cmp = client_id_cmp;
> - header_msg = "Sorting clients by sysfs id.";
> - }
> + ++client_sort;
> + if (client_sort >= ARRAY_SIZE(cmp))
> + client_sort = 0;
> +
> + client_cmp = cmp[client_sort].cmp;
> + header_msg = cmp[client_sort].msg;
> }
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
-Chris
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
* [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/2] intel_gpu_top: Show banner messages when cycling sort modes
2021-02-03 11:44 ` [igt-dev] " Tvrtko Ursulin
` (2 preceding siblings ...)
(?)
@ 2021-02-03 15:01 ` Patchwork
-1 siblings, 0 replies; 11+ messages in thread
From: Patchwork @ 2021-02-03 15:01 UTC (permalink / raw)
To: Tvrtko Ursulin; +Cc: igt-dev
== Series Details ==
Series: series starting with [i-g-t,1/2] intel_gpu_top: Show banner messages when cycling sort modes
URL : https://patchwork.freedesktop.org/series/86640/
State : failure
== Summary ==
Applying: intel_gpu_top: Show banner messages when cycling sort modes
Patch failed at 0001 intel_gpu_top: Show banner messages when cycling sort modes
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-02-03 15:01 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-03 11:44 [Intel-gfx] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes Tvrtko Ursulin
2021-02-03 11:44 ` [igt-dev] " Tvrtko Ursulin
2021-02-03 11:44 ` [Intel-gfx] [PATCH i-g-t 2/2] intel_gpu_top: Add option to sort by PID Tvrtko Ursulin
2021-02-03 11:44 ` [igt-dev] " Tvrtko Ursulin
2021-02-03 11:50 ` [Intel-gfx] " Chris Wilson
2021-02-03 11:50 ` [igt-dev] " Chris Wilson
2021-02-03 11:47 ` [Intel-gfx] [igt-dev] [PATCH i-g-t 1/2] intel_gpu_top: Show banner messages when cycling sort modes Chris Wilson
2021-02-03 11:47 ` Chris Wilson
2021-02-03 11:49 ` [Intel-gfx] " Tvrtko Ursulin
2021-02-03 11:49 ` Tvrtko Ursulin
2021-02-03 15:01 ` [igt-dev] ✗ Fi.CI.BUILD: failure for series starting with [i-g-t,1/2] " Patchwork
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.