[CI 6/6] tools/gputop: Extract clrscr()

Lucas De Marchi lucas.demarchi at intel.com
Tue Apr 30 19:01:50 UTC 2024


Make it clear what the CSI is doing.

Reviewed-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa at intel.com>
Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
---
 tools/gputop.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tools/gputop.c b/tools/gputop.c
index 455f77d0c..8cec951b4 100644
--- a/tools/gputop.c
+++ b/tools/gputop.c
@@ -285,6 +285,11 @@ static void update_console_size(int *w, int *h)
 	}
 }
 
+static void clrscr(void)
+{
+	printf("\033[H\033[J");
+}
+
 int main(int argc, char **argv)
 {
 	unsigned int period_us = 2e6;
@@ -301,12 +306,11 @@ int main(int argc, char **argv)
 		struct igt_drm_client *c, *prevc = NULL;
 		int i, engine_w = 0, lines = 0;
 
-		update_console_size(&con_w, &con_h);
-
 		igt_drm_clients_scan(clients, NULL, NULL, 0, NULL, 0);
 		igt_drm_clients_sort(clients, client_cmp);
 
-		printf("\033[H\033[J");
+		update_console_size(&con_w, &con_h);
+		clrscr();
 
 		igt_for_each_drm_client(clients, c, i) {
 			assert(c->status != IGT_DRM_CLIENT_PROBE);
-- 
2.43.0



More information about the igt-dev mailing list