From: Michael Tremer Date: Wed, 7 Aug 2024 13:29:57 +0000 (+0200) Subject: services.cgi: Use new functions to figure out memory usage X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6fa4cdf7e3dcfa0ede6e5b976e185dff6893f8b3;p=people%2Fmfischer%2Fipfire-2.x.git services.cgi: Use new functions to figure out memory usage Signed-off-by: Michael Tremer --- diff --git a/html/cgi-bin/services.cgi b/html/cgi-bin/services.cgi index 678b31547..91cdd3958 100644 --- a/html/cgi-bin/services.cgi +++ b/html/cgi-bin/services.cgi @@ -232,17 +232,13 @@ sub isrunningaddon (@) { my @pid = split(/\s/,$testcmd); $status .="$pid[0]"; - my $memory = 0; + # Fetch the memory consumption + my $memory = &General::get_memory_consumption(@pid); - foreach (@pid){ - chomp($_); - if (open(FILE, "/proc/$_/statm")){ - my $temp = ; - @memory = split(/ /,$temp); - } - $memory+=$memory[0]; - } - $status .="$memory KB"; + # Format memory + $memory = &General::formatBytes($memory); + + $status .="$memory"; }else{ $status = "$Lang::tr{"; $status .= "$Lang::tr{'stopped'}";