[pve-devel] [RFC common 2/4] add more detailed statistics to memory report

Folke Gleumes f.gleumes at proxmox.com
Mon Dec 11 15:47:19 CET 2023


Signed-off-by: Folke Gleumes <f.gleumes at proxmox.com>
---
 src/PVE/ProcFSTools.pm | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/PVE/ProcFSTools.pm b/src/PVE/ProcFSTools.pm
index 3826fcc..5f5d768 100644
--- a/src/PVE/ProcFSTools.pm
+++ b/src/PVE/ProcFSTools.pm
@@ -279,7 +279,10 @@ sub read_meminfo {
     my $res = {
 	memtotal => 0,
 	memfree => 0,
+	memavailable => 0,
 	memused => 0,
+	membuffers => 0,
+	memcached => 0,
 	memshared => 0,
 	swaptotal => 0,
 	swapfree => 0,
@@ -299,7 +302,13 @@ sub read_meminfo {
     close($fh);
 
     $res->{memtotal} = $d->{memtotal};
-    $res->{memfree} =  $d->{memfree} + $d->{buffers} + $d->{cached};
+    $res->{memfree} = $d->{memfree};
+    $res->{membuffers} = $d->{buffers};
+    $res->{memcached} = $d->{cached};
+    $res->{memshared} = $d->{memshared};
+
+    # memfree is unused memory, memused is everything that is in use
+    # be it by caches, buffers or applications
     $res->{memused} = $res->{memtotal} - $res->{memfree};
 
     $res->{swaptotal} = $d->{swaptotal};
-- 
2.39.2





More information about the pve-devel mailing list