From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Message-ID: <93ff2b62-3840-57a5-09a4-08ed264fedeb@linux.intel.com> Date: Mon, 17 Apr 2023 11:58:29 +0100 MIME-Version: 1.0 Content-Language: en-US To: Kamil Konieczny , igt-dev@lists.freedesktop.org, Intel-gfx@lists.freedesktop.org References: <20230328125429.1970202-1-tvrtko.ursulin@linux.intel.com> <20230328125429.1970202-4-tvrtko.ursulin@linux.intel.com> <20230414152814.vynozqkcrdete2bp@kamilkon-desk1> From: Tvrtko Ursulin In-Reply-To: <20230414152814.vynozqkcrdete2bp@kamilkon-desk1> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [igt-dev] [Intel-gfx] [PATCH i-g-t 3/3] intel_gpu_top: Show non-normalized client usage in numeric mode List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: igt-dev-bounces@lists.freedesktop.org Sender: "igt-dev" List-ID: 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 >> >> 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 > > Reviewed-by: Kamil Konieczny 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 >>