From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org
Cc: Rob Clark <robdclark@chromium.org>
Subject: [Intel-gfx] [PATCH i-g-t 1/2] gputop: Move client name last
Date: Mon, 15 May 2023 14:36:29 +0100 [thread overview]
Message-ID: <20230515133630.2163170-2-tvrtko.ursulin@linux.intel.com> (raw)
In-Reply-To: <20230515133630.2163170-1-tvrtko.ursulin@linux.intel.com>
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Move client name to be the right most field which visually aligns better
with top(1) and prepares for inserting memory usage fields somewhere in
the middle.
Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Cc: Rob Clark <robdclark@chromium.org>
---
tools/gputop.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/tools/gputop.c b/tools/gputop.c
index 4fb5ce63e07c..681f0a6bb748 100644
--- a/tools/gputop.c
+++ b/tools/gputop.c
@@ -80,15 +80,15 @@ print_client_header(struct igt_drm_client *c, int lines, int con_w, int con_h,
return lines;
putchar('\n');
- len = printf("%*s %*s ",
- c->clients->max_pid_len, "PID",
- c->clients->max_name_len, "NAME");
+ len = printf("%*s ", c->clients->max_pid_len, "PID");
if (c->engines->num_engines) {
unsigned int i;
int width;
- *engine_w = width = (con_w - len) / c->engines->num_engines;
+ *engine_w = width =
+ (con_w - len - c->clients->max_name_len - 1) /
+ c->engines->num_engines;
for (i = 0; i <= c->engines->max_engine_id; i++) {
const char *name = c->engines->names[i];
@@ -109,8 +109,7 @@ print_client_header(struct igt_drm_client *c, int lines, int con_w, int con_h,
}
}
- n_spaces(con_w - len);
- printf("\033[0m\n");
+ printf(" %-*s\033[0m\n", con_w - len - 1, "NAME");
return lines;
}
@@ -128,6 +127,7 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
unsigned int period_us, int *engine_w)
{
unsigned int i;
+ int len;
/* Filter out idle clients. */
if (!c->total_runtime || c->samples < 2)
@@ -142,9 +142,7 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
*prevc = c;
- printf("%*s %*s ",
- c->clients->max_pid_len, c->pid_str,
- c->clients->max_name_len, c->print_name);
+ len = printf("%*s ", c->clients->max_pid_len, c->pid_str);
lines++;
for (i = 0; c->samples > 1 && i <= c->engines->max_engine_id; i++) {
@@ -164,9 +162,10 @@ print_client(struct igt_drm_client *c, struct igt_drm_client **prevc,
pct = 100.0;
print_percentage_bar(pct, *engine_w);
+ len += *engine_w;
}
- putchar('\n');
+ printf(" %-*s\n", con_w - len - 1, c->print_name);
return lines;
}
--
2.37.2
next prev parent reply other threads:[~2023-05-15 13:36 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-15 13:36 [Intel-gfx] [PATCH i-g-t 0/2] gputop/intel_gpu_top: Move name to be the last field Tvrtko Ursulin
2023-05-15 13:36 ` Tvrtko Ursulin [this message]
2023-05-23 10:50 ` [Intel-gfx] [PATCH i-g-t 1/2] gputop: Move client name last Kamil Konieczny
2023-05-15 13:36 ` [Intel-gfx] [PATCH i-g-t 2/2] intel_gpu_top: " Tvrtko Ursulin
2023-05-23 10:51 ` Kamil Konieczny
2023-05-24 13:10 ` Tvrtko Ursulin
2023-05-15 14:14 ` [Intel-gfx] [PATCH i-g-t 0/2] gputop/intel_gpu_top: Move name to be the last field Rob Clark
2023-05-23 9:36 ` Tvrtko Ursulin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230515133630.2163170-2-tvrtko.ursulin@linux.intel.com \
--to=tvrtko.ursulin@linux.intel.com \
--cc=Intel-gfx@lists.freedesktop.org \
--cc=igt-dev@lists.freedesktop.org \
--cc=robdclark@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox