[igt-dev] [PATCH i-g-t] intel_gpu_top: The return of the fractional bar

Tvrtko Ursulin tvrtko.ursulin at linux.intel.com
Fri Feb 5 14:01:46 UTC 2021


On 05/02/2021 13:45, Chris Wilson wrote:
> Scale the bar_len into the fractional bar before truncating!
> 
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> Cc: Tvrtko Ursulin <tvrtko.ursulin at intel.com>
> ---
>   tools/intel_gpu_top.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
> 
> diff --git a/tools/intel_gpu_top.c b/tools/intel_gpu_top.c
> index 5e832eb9a..453f39541 100644
> --- a/tools/intel_gpu_top.c
> +++ b/tools/intel_gpu_top.c
> @@ -1098,10 +1098,9 @@ print_percentage_bar(double percent, int max_len, bool numeric)
>   
>   	assert(max_len > 0);
>   
> -	bar_len = ceil(percent * len / 100.0);
> -	if (bar_len > len)
> -		bar_len = len;
> -	bar_len *= w;
> +	bar_len = ceil(w * percent * len / 100.0);
> +	if (bar_len > w * len)
> +		bar_len = w * len;
>   
>   	putchar('|');
>   
> 

Ah I broke this somehow, yet again. Thanks!

Reviewed-by: Tvrtko Ursulin <tvrtko.ursulin at intel.com>

Regards,

Tvrtko


More information about the igt-dev mailing list