Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Kamil Konieczny <kamil.konieczny@linux.intel.com>,
	igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH i-g-t 3/3] intel_gpu_top: Show non-normalized client usage in numeric mode
Date: Mon, 17 Apr 2023 11:58:29 +0100	[thread overview]
Message-ID: <93ff2b62-3840-57a5-09a4-08ed264fedeb@linux.intel.com> (raw)
In-Reply-To: <20230414152814.vynozqkcrdete2bp@kamilkon-desk1>


Hi Kamil,

On 14/04/2023 16:28, Kamil Konieczny wrote:
> On 2023-03-28 at 13:54:29 +0100, Tvrtko Ursulin wrote:
>> From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
>>
>> When numeric display is selected in the interactive mode it is more
>> descriptive to show client's non-normalized (by number of engines per
>> class) usage. Rendering of the visual representation (bar) is kept the
>> same.
>>
>> Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
> 
> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>

Thanks for reviewing all three and merging them too!

Regards,

Tvrtko

>> ---
>>   tools/intel_gpu_top.c | 20 +++++++++++---------
>>   1 file changed, 11 insertions(+), 9 deletions(-)
>>
>> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
>> index 36da016c3df0..b6827b3de9bd 100644
>> --- a/tools/intel_gpu_top.c
>> +++ b/tools/intel_gpu_top.c
>> @@ -1275,14 +1275,14 @@ static void n_spaces(const unsigned int n)
>>   }
>>   
>>   static void
>> -print_percentage_bar(double percent, int max_len, bool numeric)
>> +print_percentage_bar(double percent, double max, int max_len, bool numeric)
>>   {
>>   	int bar_len, i, len = max_len - 2;
>>   	const int w = 8;
>>   
>>   	assert(max_len > 0);
>>   
>> -	bar_len = ceil(w * percent * len / 100.0);
>> +	bar_len = ceil(w * percent * len / max);
>>   	if (bar_len > w * len)
>>   		bar_len = w * len;
>>   
>> @@ -2010,7 +2010,8 @@ print_engine(struct engines *engines, unsigned int i, double t,
>>   			      engine->display_name, engine_items[0].buf);
>>   
>>   		val = pmu_calc(&engine->busy.val, 1e9, t, 100);
>> -		print_percentage_bar(val, con_w > len ? con_w - len : 0, false);
>> +		print_percentage_bar(val, 100.0, con_w > len ? con_w - len : 0,
>> +				     false);
>>   
>>   		printf("%s\n", buf);
>>   
>> @@ -2292,23 +2293,24 @@ print_client(struct client *c, struct engines *engines, double t, int lines,
>>   		       clients->max_name_len, c->print_name);
>>   
>>   		for (i = 0; c->samples > 1 && i < clients->num_classes; i++) {
>> -			double pct;
>> +			double pct, max;
>>   
>>   			if (!clients->class[i].num_engines)
>>   				continue; /* Assert in the ideal world. */
>>   
>> -			pct = (double)c->val[i] / period_us / 1e3 * 100 /
>> -			      clients->class[i].num_engines;
>> +			pct = (double)c->val[i] / period_us / 1e3 * 100;
>>   
>>   			/*
>>   			 * Guard against possible time-drift between sampling
>>   			 * client data and time we obtained our time-delta from
>>   			 * PMU.
>>   			 */
>> -			if (pct > 100.0)
>> -				pct = 100.0;
>> +			max = 100.0 * clients->class[i].num_engines;
>> +			if (pct > max)
>> +				pct = max;
>>   
>> -			print_percentage_bar(pct, *class_w, numeric_clients);
>> +			print_percentage_bar(pct, max, *class_w,
>> +					     numeric_clients);
>>   		}
>>   
>>   		putchar('\n');
>> -- 
>> 2.37.2
>>

      reply	other threads:[~2023-04-17 10:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 12:54 [Intel-gfx] [PATCH i-g-t 0/3] Assorted intel_gpu_top tweaks Tvrtko Ursulin
2023-03-28 12:54 ` [Intel-gfx] [PATCH i-g-t 1/3] intel_gpu_top: Display large pids nicely in interactive mode Tvrtko Ursulin
2023-04-14 15:24   ` Kamil Konieczny
2023-03-28 12:54 ` [Intel-gfx] [PATCH i-g-t 2/3] intel_gpu_top: Use full console width for global metrics Tvrtko Ursulin
2023-04-14 15:26   ` [Intel-gfx] [igt-dev] " Kamil Konieczny
2023-03-28 12:54 ` [Intel-gfx] [PATCH i-g-t 3/3] intel_gpu_top: Show non-normalized client usage in numeric mode Tvrtko Ursulin
2023-04-14 15:28   ` Kamil Konieczny
2023-04-17 10:58     ` Tvrtko Ursulin [this message]

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=93ff2b62-3840-57a5-09a4-08ed264fedeb@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=kamil.konieczny@linux.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