From patchwork Thu Jan 12 17:47:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13098518 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 93A02C63797 for ; Thu, 12 Jan 2023 17:47:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B8C3D10E31E; Thu, 12 Jan 2023 17:47:41 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id D721B10E1A9; Thu, 12 Jan 2023 17:47:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673545659; x=1705081659; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=SdqECjK18X4s1Hdgg9NXuRf4k+LudJfR1Lia9IX2/8M=; b=S0ee24ZK+/+YmJXiRvGLq/zelFyTmZ4mo8Oo0dcT2ZLi2RE2LJbOhZ5r O6hTdbILhV+ybSMeZyfI0sDwjizWiYoYD21qZLy/Xta7/fZywvWoA4hRL j89cmeH7W7LqFIseQkC/dwQLKkkF0l9PwJ8JQTg9PtUH/OZafj+5xk0mH 3U28RQaKiF/4O2DcD2eJX9vc5hUvmr15HQQ6AJ7AcDFnGzcrTFKOarcLA MLIlV6eLOuVvAAkvkWV0B4f6G416C7HiWdTpx21HVXkiH4QC03CTgCX1p /U1IOp0MZQcGr5qTIgigN47Md0G19AGI3av3CLd3ob5XqWigWTI4IMK7U g==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="321471406" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="321471406" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:39 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="635468281" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="635468281" Received: from jacton-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.195.171]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:37 -0800 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Jan 2023 17:47:27 +0000 Message-Id: <20230112174730.1101192-2-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> References: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/4] intel_gpu_top: Fix man page formatting X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin New lines are not respected when rst2man generates the page so try to work around that by followin advice from the Internet. Signed-off-by: Tvrtko Ursulin Reviewed-by: Kamil Konieczny --- man/intel_gpu_top.rst | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst index 748c7740c800..b0c95446a011 100644 --- a/man/intel_gpu_top.rst +++ b/man/intel_gpu_top.rst @@ -53,13 +53,14 @@ RUNTIME CONTROL Supported keys: - 'q' Exit from the tool. - 'h' Show interactive help. - '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, pid, client id). - 'i' Toggle display of clients which used no GPU time. - 'H' Toggle between per PID aggregation and individual clients. +| +| 'q' Exit from the tool. +| 'h' Show interactive help. +| '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, pid, client id). +| 'i' Toggle display of clients which used no GPU time. +| 'H' Toggle between per PID aggregation and individual clients. DEVICE SELECTION ================ From patchwork Thu Jan 12 17:47:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13098519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 73373C61DB3 for ; Thu, 12 Jan 2023 17:47:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5130810E323; Thu, 12 Jan 2023 17:47:47 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id F25D410E31F; Thu, 12 Jan 2023 17:47:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673545662; x=1705081662; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=H54qSIyekzhmo/TxBRoVw6YjytfjL7u3pgLCyX2Ft+g=; b=iV3wdRBQu+zc5ne5DFqNkzklaf87w6WWS7eOJlyevkT3CIOUedvQoGWf jnV2H0U4TEdm/+d2uXzO8HKOWrPTbkB3x1QjF8R4a8TYmhU6wQfiGK7/W q/Bxws4ngzv32bPpQZT3nTmuADnr1KSx/QDAeY8d6iEwcWQGG4YnuLYGJ 9HUFxUW+QtWikeTZh9h9LFsELF8zfsQGqiXTNdZZQGwMit6gyZP8KTabn j8P/W9Mw2e73OEOl963QvCHwcUYhAP3yqZiEpRcL+c873/V1Xf9PYL+Kq L8SvTV/SxFy2USGpA58SSEcqP7gVBs5l7rXZeR/VI22cZlmNEFlt4qAGb g==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="321471421" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="321471421" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:40 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="635468288" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="635468288" Received: from jacton-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.195.171]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:39 -0800 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Jan 2023 17:47:28 +0000 Message-Id: <20230112174730.1101192-3-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> References: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/4] intel_gpu_top: Automatically enclose JSON output into brackets X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Eero Tamminen Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Parsers need the whole output enclosed into square brackets so every period sample becomes an array element. So far we have been suggesting this in the man page but we can trivially make the tool output that itself. Signed-off-by: Tvrtko Ursulin Cc: Eero Tamminen Reviewed-by: Kamil Konieczny --- man/intel_gpu_top.rst | 2 +- tools/intel_gpu_top.c | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst index b0c95446a011..3317e04816b4 100644 --- a/man/intel_gpu_top.rst +++ b/man/intel_gpu_top.rst @@ -85,7 +85,7 @@ Filter types: :: JSON OUTPUT =========== -To parse the JSON as output by the tool the consumer should wrap its entirety into square brackets ([ ]). This will make each sample point a JSON array element and will avoid "Multiple root elements" JSON validation error. +JSON output will be correctly terminated when the tool cleanly exits, otherwise one square bracket needs to be added before parsing. LIMITATIONS =========== diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index 6de8a164fcff..c4d98de4fe31 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -2597,6 +2597,9 @@ int main(int argc, char **argv) scan_clients(clients, false); codename = igt_device_get_pretty_name(&card, false); + if (output_mode == JSON) + printf("[\n"); + while (!stop_top) { struct clients *disp_clients; bool consumed = false; @@ -2683,6 +2686,9 @@ int main(int argc, char **argv) usleep(period_us); } + if (output_mode == JSON) + printf("]\n"); + if (clients) free_clients(clients); From patchwork Thu Jan 12 17:47:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13098520 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 053B8C54EBE for ; Thu, 12 Jan 2023 17:47:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D23F510E325; Thu, 12 Jan 2023 17:47:47 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BD0F10E31F; Thu, 12 Jan 2023 17:47:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673545663; x=1705081663; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DNIwNWuNWyV6ulvUpZOHP/I5w7/HD6qHg/4Spe+yx7U=; b=W/1OhsN51O+aDqcy6B3w8jxlLWHitTz9UnMc2/WjFjqzIIXuqc16nFG+ NYIB6tPHXdKrXg/qUzl/yS4QP+fguB5wtdFIZxDpRB4UG9BmoxcGpjDbY 2eoCLGorZAixRYCCqBammyw3ss5YGQA3hsiy4ZbHn+hb7YqO5AR5pm7Og ia0VKc7i44TeII/jniTYNBHC/K7QpZCi7DUz3gp/d/WLuzpumWn8/tJay 7QsEMF1PqT85HReURsejeOkBDTtj/iYPC9ZzQFmPjKKSlfRXY3a1OUEPl 6GhYU+P3XprhX7S0KYuzUB5ylX3OKHBXxNpOEE1fI1bfvDQS0OGn0Jf4g w==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="321471435" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="321471435" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:42 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="635468294" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="635468294" Received: from jacton-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.195.171]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:41 -0800 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Jan 2023 17:47:29 +0000 Message-Id: <20230112174730.1101192-4-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> References: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 3/4] intel_gpu_top: Add command line switch to start in physical engine mode X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Default mode is to aggreate engines per class but some users would prefer to be able to start in physical engine mode too. Signed-off-by: Tvrtko Ursulin Cc: Dmitry Rogozhkin Reviewed-by: Kamil Konieczny --- man/intel_gpu_top.rst | 3 +++ tools/intel_gpu_top.c | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/man/intel_gpu_top.rst b/man/intel_gpu_top.rst index 3317e04816b4..b24216c0ae91 100644 --- a/man/intel_gpu_top.rst +++ b/man/intel_gpu_top.rst @@ -48,6 +48,9 @@ OPTIONS -d Select a specific GPU using supported filter. +-p + Default to showing physical engines instead of classes. + RUNTIME CONTROL =============== diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index c4d98de4fe31..e91b47baf72b 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -1268,6 +1268,7 @@ usage(const char *appname) "\t[-s ] Refresh period in milliseconds (default %ums).\n" "\t[-L] List all cards.\n" "\t[-d ] Device filter, please check manual page for more details.\n" + "\t[-p] Default to showing physical engines instead of classes.\n" "\n", appname, DEFAULT_PERIOD_MS); igt_device_print_filter_types(); @@ -2446,6 +2447,7 @@ int main(int argc, char **argv) { unsigned int period_us = DEFAULT_PERIOD_MS * 1000; struct clients *clients = NULL; + bool physical_engines = false; int con_w = -1, con_h = -1; char *output_path = NULL; struct engines *engines; @@ -2456,7 +2458,7 @@ int main(int argc, char **argv) char *codename = NULL; /* Parse options */ - while ((ch = getopt(argc, argv, "o:s:d:JLlh")) != -1) { + while ((ch = getopt(argc, argv, "o:s:d:pJLlh")) != -1) { switch (ch) { case 'o': output_path = optarg; @@ -2467,6 +2469,9 @@ int main(int argc, char **argv) case 'd': opt_device = strdup(optarg); break; + case 'p': + physical_engines = true; + break; case 'J': output_mode = JSON; break; @@ -2508,7 +2513,7 @@ int main(int argc, char **argv) case INTERACTIVE: pops = &term_pops; interactive_stdin(); - class_view = true; + class_view = !physical_engines; break; case STDOUT: pops = &stdout_pops; From patchwork Thu Jan 12 17:47:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 13098521 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 556D4C63797 for ; Thu, 12 Jan 2023 17:47:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2B41110E326; Thu, 12 Jan 2023 17:47:50 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id A5EA510E324; Thu, 12 Jan 2023 17:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1673545667; x=1705081667; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ILgqxmkG7xi2TIdzfakuV56plI8HVj7HODrUz0W83z8=; b=ZmMpCr/jJTy5NS7rioIMwUI9D+2P8uvyiLOupPUXrUDTBBhJt90iTgdg 6Tl46g4bJsGj6Bak0XDK/4BpN6fkUbr8igraQB4UyDPmAjxQSUcsSlm3I DKwNedM27GNoohhTdVEas0sSPPKZ/CD9IX24BvovhvuxbX5Tz4tcFENcU IPj7B7AAxPp0GQpADkjvUP22q4Rgou1v1Zl8YCd6lU/F8QFQm1svSq09q 4HGmTNKQqDmYIUz+neQsmk/PJScvPtD7xJOm+3bb1Ml+y7Xv9UvCxfnqz U2D02dMpRF+OxGItI9kFH+2NPtwr9EsskpKlgrIHTUkB/PAVn1SQNPUqX w==; X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="321471446" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="321471446" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:44 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10588"; a="635468304" X-IronPort-AV: E=Sophos;i="5.97,211,1669104000"; d="scan'208";a="635468304" Received: from jacton-mobl.ger.corp.intel.com (HELO localhost.localdomain) ([10.213.195.171]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2023 09:47:42 -0800 From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org Date: Thu, 12 Jan 2023 17:47:30 +0000 Message-Id: <20230112174730.1101192-5-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> References: <20230112174730.1101192-1-tvrtko.ursulin@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 4/4] intel_gpu_top: Aggregate engine classes in all output modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Tvrtko Ursulin Use the same default for stdout and JSON output modes as it is for interactive. Previously added command line switch can be used to go back to showing all physical engines. Signed-off-by: Tvrtko Ursulin Cc: Dmitry Rogozhkin Reviewed-by: Kamil Konieczny --- tools/intel_gpu_top.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c index e91b47baf72b..7aa233570463 100644 --- a/tools/intel_gpu_top.c +++ b/tools/intel_gpu_top.c @@ -2509,11 +2509,12 @@ int main(int argc, char **argv) if (signal(SIGINT, sigint_handler) == SIG_ERR) fprintf(stderr, "Failed to install signal handler!\n"); + class_view = !physical_engines; + switch (output_mode) { case INTERACTIVE: pops = &term_pops; interactive_stdin(); - class_view = !physical_engines; break; case STDOUT: pops = &stdout_pops;