From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: Proxmox VE development discussion <pve-devel@lists.proxmox.com>,
Aaron Lauterer <a.lauterer@proxmox.com>
Subject: Re: [pve-devel] [PATCH common 2/4] add functions to retrieve pressures for vm/ct
Date: Mon, 2 Jun 2025 16:39:30 +0200 [thread overview]
Message-ID: <08e2f997-0249-45c8-85b1-1c71b4d025a7@proxmox.com> (raw)
In-Reply-To: <20250523163749.428293-1-a.lauterer@proxmox.com>
Am 23.05.25 um 18:37 schrieb Aaron Lauterer:
> From: Folke Gleumes <f.gleumes@proxmox.com>
>
> Originally-by: Folke Gleumes <f.gleumes@proxmox.com>
> [AL: rebased on current master]
> Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
> ---
> src/PVE/ProcFSTools.pm | 22 ++++++++++++++++++++++
> 1 file changed, 22 insertions(+)
>
> diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
> index f9fe3f0..382e6c5 100644
> --- a/src/PVE/ProcFSTools.pm
> +++ b/src/PVE/ProcFSTools.pm
> @@ -151,6 +151,28 @@ sub parse_pressure {
> return $res;
> }
>
> +sub read_qemu_pressure {
> + my ($vmid) = @_;
> +
> + my $res = {};
> + foreach my $type (qw(cpu memory io)) {
> + my $stats = parse_pressure("/sys/fs/cgroup/qemu.slice/$vmid.scope/$type.pressure");
There is a SysFSTools module ;-)
But OK, the parse_pressure method is here, so finish I guess.
I'd rather have this more generic though, as you got just two copies of the
same code going on here, and nothing here is specific to qemu or lxc; every
cgroup has these.
So I'd rather switch this over to a single
sub read_cgroup_pressure {
my ($cgroup_path) = @_;
my $res = {};
for my $type (qw(cpu memory io)) {
my $stats = parse_pressure("/sys/fs/cgroup/${cgroup_path}/${type}.pressure");
$res->{$type} = $stats if $stats;
}
return $res;
}
If we want to abstract away the base cgroup that would be a job for a
pve-guest-common interface and respective implementation in pve-container
and qemu-server, but it's probably fine to just assemble the path where
needed (manager I'd figure?), in any case not worse than hard-coding it in
a dependency leave node like here.
> + $res->{$type} = $stats if $stats;
> + }
> + return $res;
> +}
> +
> +sub read_lxc_pressure {
> + my ($vmid) = @_;
> +
> + my $res = {};
> + foreach my $type (qw(cpu memory io)) {
> + my $stats = parse_pressure("/sys/fs/cgroup/lxc/$vmid/$type.pressure");
> + $res->{$type} = $stats if $stats;
> + }
> + return $res;
> +}
> +
> sub read_pressure {
> my $res = {};
> foreach my $type (qw(cpu memory io)) {
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
next prev parent reply other threads:[~2025-06-02 14:39 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-23 16:00 [pve-devel] [RFC cluster/common/container/manager/pve9-rrd-migration-tool/qemu-server/storage 00/19] Expand and migrate RRD data Aaron Lauterer
2025-05-23 16:00 ` [pve-devel] [PATCH cluster-pve8 1/2] cfs status.c: drop old pve2-vm rrd schema support Aaron Lauterer
2025-05-23 16:00 ` [pve-devel] [PATCH cluster-pve8 2/2] status: handle new pve9- metrics update data Aaron Lauterer
2025-05-23 16:35 ` Aaron Lauterer
2025-06-02 13:31 ` Thomas Lamprecht
2025-06-11 14:18 ` Aaron Lauterer
2025-05-23 16:00 ` [pve-devel] [PATCH pve9-rrd-migration-tool 1/1] introduce rrd migration tool for pve8 -> pve9 Aaron Lauterer
2025-05-23 16:00 ` [pve-devel] [PATCH cluster 1/1] status: introduce new pve9- rrd and metric format Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH common 1/4] fix error in pressure parsing Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH common 2/4] add functions to retrieve pressures for vm/ct Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH common 3/4] add helper to fetch value from smaps_rollup for pid Aaron Lauterer
2025-06-02 14:11 ` Thomas Lamprecht
2025-05-23 16:37 ` [pve-devel] [PATCH common 4/4] metrics: add buffer and cache to meminfo Aaron Lauterer
2025-06-02 14:07 ` Thomas Lamprecht
2025-06-11 15:17 ` Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH manager 1/5] api2tools: drop old VM rrd schema Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH manager 2/5] pvestatd: collect and distribute new pve9- metrics Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH manager 3/5] api: nodes: rrd and rrddata fetch from new pve9-node rrd files if present Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH manager 4/5] api2tools: extract stats: handle existence of new pve9- data Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH manager 5/5] ui: rrdmodels: add new columns Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH storage 1/1] status: rrddata: use new pve9 rrd location if file is present Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH qemu-server 1/4] metrics: add pressure to metrics Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH qemu-server 2/4] vmstatus: add memhost for host view of vm mem consumption Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH qemu-server 3/4] vmstatus: switch mem stat to PSS of VM cgroup Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH qemu-server 4/4] rrddata: use new pve9 rrd location if file is present Aaron Lauterer
2025-05-23 16:37 ` [pve-devel] [PATCH container 1/1] " Aaron Lauterer
2025-06-02 14:39 ` Thomas Lamprecht [this message]
2025-05-26 11:52 ` [pve-devel] [RFC cluster/common/container/manager/pve9-rrd-migration-tool/qemu-server/storage 00/19] Expand and migrate RRD data DERUMIER, Alexandre via pve-devel
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=08e2f997-0249-45c8-85b1-1c71b4d025a7@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=a.lauterer@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