From: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
To: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: <igt-dev@lists.freedesktop.org>, Tvrtko Ursulin <tursulin@ursulin.net>
Subject: Re: [PATCH i-g-t 10/12] gputop: Extract method to update console size
Date: Thu, 18 Apr 2024 15:51:51 -0700 [thread overview]
Message-ID: <ZiGkB2hXJH+YpyP6@orsosgc001> (raw)
In-Reply-To: <20240405060056.59379-11-lucas.demarchi@intel.com>
On Fri, Apr 05, 2024 at 01:00:54AM -0500, Lucas De Marchi wrote:
>Cleanup the mainloop moving the console size handling to a helper
>functions.
>
>Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
>---
> tools/gputop.c | 30 +++++++++++++++++++-----------
> 1 file changed, 19 insertions(+), 11 deletions(-)
>
>diff --git a/tools/gputop.c b/tools/gputop.c
>index b13044b50..1f349b3ed 100644
>--- a/tools/gputop.c
>+++ b/tools/gputop.c
>@@ -243,6 +243,23 @@ static int client_cmp(const void *_a, const void *_b, void *unused)
>
> }
>
>+static void update_console_size(int *w, int *h)
>+{
>+ struct winsize ws = {};
>+
>+ if (ioctl(0, TIOCGWINSZ, &ws) == -1)
>+ return;
>+
>+ *w = ws.ws_col;
>+ *h = ws.ws_row;
>+
>+ if (*w == 0 && *h == 0) {
>+ /* Serial console. */
>+ *w = 80;
>+ *h = 24;
>+ }
>+}
>+
> int main(int argc, char **argv)
> {
> unsigned int period_us = 2e6;
>@@ -258,17 +275,8 @@ int main(int argc, char **argv)
> for (;;) {
> struct igt_drm_client *c, *prevc = NULL;
> int i, engine_w = 0, lines = 0;
>- struct winsize ws;
>-
>- if (ioctl(0, TIOCGWINSZ, &ws) != -1) {
>- con_w = ws.ws_col;
>- con_h = ws.ws_row;
>- if (con_w == 0 && con_h == 0) {
>- /* Serial console. */
>- con_w = 80;
>- con_h = 24;
>- }
>- }
>+
>+ update_console_size(&con_w, &con_h);
>
> igt_drm_clients_scan(clients, NULL, NULL, 0, NULL, 0);
> igt_drm_clients_sort(clients, client_cmp);
>--
>2.44.0
>
next prev parent reply other threads:[~2024-04-18 22:51 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-05 6:00 [PATCH i-g-t 00/12] gputop: Add support for xe Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 01/12] lib/igt_drm_fdinfo: Stop passing key twice Lucas De Marchi
2024-04-18 22:14 ` Umesh Nerlige Ramappa
2024-04-19 7:42 ` Tvrtko Ursulin
2024-04-19 16:35 ` Lucas De Marchi
2024-04-19 18:34 ` Tvrtko Ursulin
2024-04-05 6:00 ` [PATCH i-g-t 02/12] lib/igt_drm_fdinfo: Remove prefix arg from parse functions Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 03/12] lib/igt_drm_fdinfo: Fix wrong name len assert Lucas De Marchi
2024-04-18 22:25 ` Umesh Nerlige Ramappa
2024-04-19 7:48 ` Tvrtko Ursulin
2024-04-19 7:49 ` Tvrtko Ursulin
2024-04-05 6:00 ` [PATCH i-g-t 04/12] lib/igt_drm_fdinfo: Assert pdev is not truncated Lucas De Marchi
2024-04-18 22:27 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 05/12] lib/igt_drm_fdinfo: Detect invalid drm-client-id Lucas De Marchi
2024-04-18 22:31 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 06/12] lib/igt_drm_fdinfo: Stop ignoring space where not needed Lucas De Marchi
2024-04-18 22:34 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 07/12] lib/igt_drm_fdinfo: Parse unit for engine utilization Lucas De Marchi
2024-04-18 22:48 ` Umesh Nerlige Ramappa
2024-04-19 7:58 ` Tvrtko Ursulin
2024-04-19 16:21 ` Lucas De Marchi
2024-04-19 18:32 ` Tvrtko Ursulin
2024-04-05 6:00 ` [PATCH i-g-t 08/12] lib/igt_drm_fdinfo: Store 2 counters for "ticks" unit Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 09/12] lib/igt_drm_clients: Store second data for ticks busyness Lucas De Marchi
2024-04-05 6:00 ` [PATCH i-g-t 10/12] gputop: Extract method to update console size Lucas De Marchi
2024-04-18 22:51 ` Umesh Nerlige Ramappa [this message]
2024-04-05 6:00 ` [PATCH i-g-t 11/12] gputop: Extract clrscr() Lucas De Marchi
2024-04-18 22:52 ` Umesh Nerlige Ramappa
2024-04-05 6:00 ` [PATCH i-g-t 12/12] RFC: gputop: Add support for ticks unit Lucas De Marchi
2024-04-05 8:04 ` ✗ GitLab.Pipeline: warning for gputop: Add support for xe Patchwork
2024-04-05 8:17 ` ✓ CI.xeBAT: success " Patchwork
2024-04-05 8:27 ` ✓ Fi.CI.BAT: " Patchwork
2024-04-05 16:22 ` ✗ Fi.CI.IGT: failure " Patchwork
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=ZiGkB2hXJH+YpyP6@orsosgc001 \
--to=umesh.nerlige.ramappa@intel.com \
--cc=igt-dev@lists.freedesktop.org \
--cc=lucas.demarchi@intel.com \
--cc=tursulin@ursulin.net \
/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