]> git.ipfire.org Git - people/mfischer/ipfire-2.x.git/commitdiff
services.cgi: Use new functions to figure out memory usage
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Aug 2024 13:29:57 +0000 (15:29 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Aug 2024 13:29:57 +0000 (15:29 +0200)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/services.cgi

index 678b31547945ba581b554a3a213b1b54586fd404..91cdd3958d4d83e64201360504387237c0a318c1 100644 (file)
@@ -232,17 +232,13 @@ sub isrunningaddon (@) {
                my @pid = split(/\s/,$testcmd);
                $status .="<td align='center'>$pid[0]</td>";
 
-               my $memory = 0;
+               # Fetch the memory consumption
+               my $memory = &General::get_memory_consumption(@pid);
 
-               foreach (@pid){
-                       chomp($_);
-                       if (open(FILE, "/proc/$_/statm")){
-                               my $temp = <FILE>;
-                               @memory = split(/ /,$temp);
-                       }
-                       $memory+=$memory[0];
-               }
-               $status .="<td align='center'>$memory KB</td>";
+               # Format memory
+               $memory = &General::formatBytes($memory);
+
+               $status .="<td align='right'>$memory</td>";
        }else{
                $status = "<td align='center' width='16%' colspan=2><a href='services.cgi?$pak!start!$service'><img alt='$Lang::tr{'start'}' title='$Lang::tr{'start'}' src='/images/go-up.png' border='0' /></a></td>";
                $status .= "<td class='status is-stopped'>$Lang::tr{'stopped'}</td><td colspan='2'></td>";