public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Maximiliano Sandoval <m.sandoval@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH container] fix #4765: pct: do not report cpu usage
Date: Thu, 29 Jun 2023 13:34:23 +0200	[thread overview]
Message-ID: <20230629113423.18311-1-m.sandoval@proxmox.com> (raw)

When running `pct status VMID` the variable
$last_proc_vmid_stat->{$vmid} is not set and pct reports no cpu usage.

For consistency with the qt command we do not print the cpu usage.

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
---

This is a different approach that the one tried at
https://lists.proxmox.com/pipermail/pve-devel/2023-June/057771.html.

While we could run the computation twice after a time delta to get *a* number
there are many open questions, like how would a user interpret this value, and
how is this time delta going to be documented, etc.

 src/PVE/CLI/pct.pm | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/PVE/CLI/pct.pm b/src/PVE/CLI/pct.pm
index ff75d33..a0b9bce 100755
--- a/src/PVE/CLI/pct.pm
+++ b/src/PVE/CLI/pct.pm
@@ -67,6 +67,7 @@ __PACKAGE__->register_method ({
 	    foreach my $k (sort (keys %$stat)) {
 		my $v = $stat->{$k};
 		next if !defined($v);
+		next if $k eq 'cpu';
 		print "$k: $v\n";
 	    }
 	} else {
-- 
2.39.2





             reply	other threads:[~2023-06-29 11:34 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-29 11:34 Maximiliano Sandoval [this message]
2023-07-18 14:00 ` [pve-devel] applied: " Thomas Lamprecht

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=20230629113423.18311-1-m.sandoval@proxmox.com \
    --to=m.sandoval@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal