Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: "Zbigniew Kempczyński" <zbigniew.kempczynski@intel.com>,
	igt-dev@lists.freedesktop.org
Cc: Petri Latvala <petri.latvala@intel.com>,
	Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Subject: Re: [igt-dev] [PATCH i-g-t 2/2] tools/intel_gpu_top: Add generation info in header
Date: Tue, 17 Nov 2020 10:15:31 +0000	[thread overview]
Message-ID: <242f9059-3e52-b8d5-019e-b764f04a6066@linux.intel.com> (raw)
In-Reply-To: <20201117094830.103153-2-zbigniew.kempczynski@intel.com>


On 17/11/2020 09:48, Zbigniew Kempczyński wrote:
> In multi device world we may want to see generation of device we're
> tracking counters. Add generation number/codename to be more verbose.

So the result is:

intel-gpu-top: /dev/dri/card0 [gen9: skylake] -    0/   0 MHz;  100% RC6;  0.00 Watts;        0 irqs/s

Alternative idea?:

intel-gpu-top: Skylake (Gen9) @ /dev/dri/card0 -    0/   0 MHz;  100% RC6;  0.00 Watts;        0 irqs/s

Should we go further?:

$ lsgpu --sysfs
card0               Intel Skylake(tm) (Gen9)    sys:/sys/devices/pci0000:00/0000:00:02.0/drm/card0
└─renderD128                   	      		sys:/sys/devices/pci0000:00/0000:00:02.0/drm/renderD128

? :)

> 
> Signed-off-by: Zbigniew Kempczyński <zbigniew.kempczynski@intel.com>
> Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> Cc: Petri Latvala <petri.latvala@intel.com>
> ---
>   lib/Makefile.am       |  4 +++-
>   lib/meson.build       |  1 +
>   tools/intel_gpu_top.c | 12 ++++++++++--
>   3 files changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/Makefile.am b/lib/Makefile.am
> index fecf34cd..c476eeab 100644
> --- a/lib/Makefile.am
> +++ b/lib/Makefile.am
> @@ -118,7 +118,9 @@ libigt_device_scan_la_SOURCES = \
>   	igt_list.c		\
>   	igt_tools_stub.c	\
>   	igt_device_scan.c	\
> -	igt_device_scan.h
> +	igt_device_scan.h	\
> +	intel_device_info.c	\
> +	intel_chipset.h
>   
>   libigt_perf_la_SOURCES = \
>   	igt_perf.c	 \
> diff --git a/lib/meson.build b/lib/meson.build
> index 090a10cd..540facb2 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -182,6 +182,7 @@ lib_igt_device_scan_build = static_library('igt_device_scan',
>   	['igt_device_scan.c',
>   	'igt_list.c',
>   	'igt_tools_stub.c',
> +	'intel_device_info.c',
>   	],
>   	dependencies : scan_dep,
>   	include_directories : inc)
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index 86de09aa..39529be9 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -22,6 +22,7 @@
>    */
>   
>   #include "igt_device_scan.h"
> +#include "intel_chipset.h"
>   
>   #include <stdio.h>
>   #include <sys/types.h>
> @@ -1028,9 +1029,12 @@ static bool print_groups(struct cnt_group **groups)
>   
>   static int
>   print_header(const struct igt_device_card *card,
> +	     const struct intel_device_info *info,
>   	     struct engines *engines, double t,
>   	     int lines, int con_w, int con_h, bool *consumed)
>   {
> +	const char *codename = info && info->codename ? info->codename : "unknown";
> +	unsigned int gen = info ? ffs(info->gen) : 0;

How about we wrap card and info into a struct (one function arg less), plus, we make the caller populate code name and gen (well maybe the whole string then) so print_headers is not doing it every time? It's not a really problem like it is, just polish maybe.

Regards,

Tvrtko

>   	struct pmu_counter fake_pmu = {
>   		.present = true,
>   		.val.cur = 1,
> @@ -1107,7 +1111,8 @@ print_header(const struct igt_device_card *card,
>   		printf("\033[H\033[J");
>   
>   		if (lines++ < con_h) {
> -			printf("intel-gpu-top: %s - ", card->card);
> +			printf("intel-gpu-top: %s [gen%u: %s] - ", card->card,
> +			       gen, codename);
>   			if (!engines->discrete)
>   				printf("%s/%s MHz;  %s%% RC6; %s %s; %s irqs/s\n",
>   					freq_items[1].buf, freq_items[0].buf,
> @@ -1317,6 +1322,7 @@ int main(int argc, char **argv)
>   	bool list_device = false;
>   	char *pmu_device, *opt_device = NULL;
>   	struct igt_device_card card;
> +	const struct intel_device_info *info = NULL;
>   
>   	/* Parse options */
>   	while ((ch = getopt(argc, argv, "o:s:d:JLlh")) != -1) {
> @@ -1441,6 +1447,8 @@ int main(int argc, char **argv)
>   	ret = EXIT_SUCCESS;
>   
>   	pmu_sample(engines);
> +	if (card.pci_device)
> +		info = intel_get_device_info(card.pci_device);
>   
>   	while (!stop_top) {
>   		bool consumed = false;
> @@ -1463,7 +1471,7 @@ int main(int argc, char **argv)
>   			break;
>   
>   		while (!consumed) {
> -			lines = print_header(&card, engines,
> +			lines = print_header(&card, info, engines,
>   					     t, lines, con_w, con_h,
>   					     &consumed);
>   
> 
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

  reply	other threads:[~2020-11-17 10:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17  9:48 [igt-dev] [PATCH i-g-t 1/2] lib/igt_device_scan: Remember vendor/device for pci devices Zbigniew Kempczyński
2020-11-17  9:48 ` [igt-dev] [PATCH i-g-t 2/2] tools/intel_gpu_top: Add generation info in header Zbigniew Kempczyński
2020-11-17 10:15   ` Tvrtko Ursulin [this message]
2020-11-17 10:16 ` [igt-dev] [PATCH i-g-t 1/2] lib/igt_device_scan: Remember vendor/device for pci devices Tvrtko Ursulin
2020-11-17 10:38   ` Zbigniew Kempczyński
2020-11-17 11:44 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [i-g-t,1/2] " Patchwork
2020-11-17 13:18 ` [igt-dev] ✗ 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=242f9059-3e52-b8d5-019e-b764f04a6066@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    --cc=tvrtko.ursulin@intel.com \
    --cc=zbigniew.kempczynski@intel.com \
    /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