From: Dominik Csapak <d.csapak@proxmox.com>
To: Dominik Rusovac <d.rusovac@proxmox.com>, pve-devel@lists.proxmox.com
Subject: Re: [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly
Date: Wed, 18 Feb 2026 12:33:53 +0100 [thread overview]
Message-ID: <ac0ba03d-dd14-4ed2-96ad-f3a5b67ebf4b@proxmox.com> (raw)
In-Reply-To: <20260218110333.158265-3-d.rusovac@proxmox.com>
On 2/18/26 12:04 PM, Dominik Rusovac wrote:
> The CPU utilization was displayed incorrectly, because the cached CPU
> utilization was mistaken to be the number of utilized CPUs. Instead the
> cached CPU utilization is the proportion of utilized CPUs. This handles
> the presentation of CPU utilization accordingly.
>
> Signed-off-by: Dominik Rusovac <d.rusovac@proxmox.com>
> ---
> src/pages/page_dashboard.rs | 10 +++-------
> 1 file changed, 3 insertions(+), 7 deletions(-)
>
> diff --git a/src/pages/page_dashboard.rs b/src/pages/page_dashboard.rs
> index f637c63..93e0f83 100644
> --- a/src/pages/page_dashboard.rs
> +++ b/src/pages/page_dashboard.rs
> @@ -109,11 +109,7 @@ impl PvePageDashboard {
> }
> }
>
> - let cpu_percentage = if maxcpu == 0 {
> - 0.0
> - } else {
> - (cpu as f32) / (maxcpu as f32)
> - };
> + let cpu_percentage = cpu * 100.0;
this looks wrong.
'cpu' is the sum of the whole cpu percentages per node, so in a 4 node
cluster this is a value between 0 and 4, so in your case it would try to
show 400% if all cpus of that cluster were fully loaded ;)
i think a better way to calculate/show that would be to
sum up the 'per core' utilization by summing up like this:
'cpu += (node.cpu * node.maxcpu)'
and then trying to divide by the sum of all 'maxcpus' again like it
was done previously
after that multiplying by 100 and showing it as a percentage
Note that the current code also don't really makes sense, since
it would only be correct if each node would only have one core
>
> let mem_percentage = if maxmem <= 0.0 {
> 0.0
> @@ -125,9 +121,9 @@ impl PvePageDashboard {
>
> tiles.push(
> icon_list_tile(Fa::new("cpu"), tr!("CPU"), (), ()).with_child(list_tile_usage(
> - format!("{:.2}", cpu),
> + format!("{cpu_percentage:.2}%"),
> maxcpu.to_string(),
> - cpu_percentage,
> + cpu as f32,
> )),
> );
>
next prev parent reply other threads:[~2026-02-18 11:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-18 11:03 [PATCH yew-mobile-gui 0/3] " Dominik Rusovac
2026-02-18 11:03 ` [PATCH yew-mobile-gui 1/3] run cargo fmt Dominik Rusovac
2026-02-18 11:03 ` [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac
2026-02-18 11:33 ` Dominik Csapak [this message]
2026-02-18 13:17 ` Dominik Rusovac
2026-02-18 11:03 ` [PATCH yew-mobile-gui 3/3] dashboard: polish CPU utilization presentation Dominik Rusovac
2026-02-18 11:21 ` Maximiliano Sandoval
2026-02-18 13:06 ` Dominik Rusovac
2026-02-19 12:11 ` superseded [PATCH yew-mobile-gui 0/3] fix #7330: dashboard: display CPU utilization correctly Dominik Rusovac
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=ac0ba03d-dd14-4ed2-96ad-f3a5b67ebf4b@proxmox.com \
--to=d.csapak@proxmox.com \
--cc=d.rusovac@proxmox.com \
--cc=pve-devel@lists.proxmox.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.