From: Folke Gleumes <f.gleu...@proxmox.com> Originally-by: Folke Gleumes <f.gleu...@proxmox.com> [AL: rebased on current master merged into single function for generic cgroups ] Signed-off-by: Aaron Lauterer <a.laute...@proxmox.com> ---
Notes: while the read_cgroup_pressure function would fit better into SysFSTools.pm I have kept it in ProcFSTools.pm for now, mainly because we currently don't use ProcFSTools in SysFSTools, and the actual function to parse the contents of the pressure files in in ProcFSTools. If that would not be an issue, we could also move the read_cgroup_pressure function to SysFSTools changes since RFC: * instead of dedicated functions for CTs and VMs we use a more generic for cgroups in general src/PVE/ProcFSTools.pm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm index f342890..f28372b 100644 --- a/src/PVE/ProcFSTools.pm +++ b/src/PVE/ProcFSTools.pm @@ -151,6 +151,17 @@ sub parse_pressure { return $res; } +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; +} + sub read_pressure { my $res = {}; foreach my $type (qw(cpu memory io)) { -- 2.39.5 _______________________________________________ pve-devel mailing list pve-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel