[igt-dev] [PATCH i-g-t] intel_gpu_top: The return of the fractional bar
Chris Wilson
chris at chris-wilson.co.uk
Fri Feb 5 13:45:46 UTC 2021
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('|');
--
2.30.0
More information about the igt-dev
mailing list