[pve-devel] [RFC common] procfstools: add arcsize to meminfo
Matthias Heiserer
m.heiserer at proxmox.com
Wed Jan 25 12:29:27 CET 2023
Signed-off-by: Matthias Heiserer <m.heiserer at proxmox.com>
---
src/PVE/ProcFSTools.pm | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index eb4b0f5..0686c34 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -283,6 +283,7 @@ sub read_meminfo {
swaptotal => 0,
swapfree => 0,
swapused => 0,
+ arcsize => 0,
};
my $fh = IO::File->new ("/proc/meminfo", "r");
@@ -307,6 +308,11 @@ sub read_meminfo {
my $spages = PVE::Tools::file_read_firstline("/sys/kernel/mm/ksm/pages_sharing") // 0 ;
$res->{memshared} = int($spages) * 4096;
+ my $arcstats = PVE::Tools::file_get_contents("/proc/spl/kstat/zfs/arcstats");
+ if ($arcstats && $arcstats =~ m/size\s+\d+\s+(\d+)/m) {
+ $res->{arcsize} = int ($1);
+ }
+
return $res;
}
--
2.30.2
More information about the pve-devel
mailing list