From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id 2ECF01FF138 for ; Wed, 18 Feb 2026 12:33:07 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 6ACEE1B447; Wed, 18 Feb 2026 12:34:05 +0100 (CET) Message-ID: Date: Wed, 18 Feb 2026 12:33:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Beta Subject: Re: [PATCH yew-mobile-gui 2/3] fix #7330: dashboard: display CPU utilization correctly To: Dominik Rusovac , pve-devel@lists.proxmox.com References: <20260218110333.158265-1-d.rusovac@proxmox.com> <20260218110333.158265-3-d.rusovac@proxmox.com> Content-Language: en-US From: Dominik Csapak In-Reply-To: <20260218110333.158265-3-d.rusovac@proxmox.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1771414433680 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.031 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: R6WSSX5WLO7GI7LUBTPW36GMS5NUGUMA X-Message-ID-Hash: R6WSSX5WLO7GI7LUBTPW36GMS5NUGUMA X-MailFrom: d.csapak@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox VE development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 > --- > 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, > )), > ); >