From 6a12882b4aaabd0cb51df7f3837bb95b3b6a0580 Mon Sep 17 00:00:00 2001 From: Andreas Geesen Date: Fri, 21 Feb 2014 12:33:05 +0100 Subject: [PATCH] Enhanced used memory calculation for values displayed in G --- plugins/system/dar_memusage | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/system/dar_memusage b/plugins/system/dar_memusage index a377f6bf..d76ba155 100755 --- a/plugins/system/dar_memusage +++ b/plugins/system/dar_memusage @@ -88,13 +88,13 @@ for ( $i = 1; ($i < $#top and $quit == 0); $i++ ) { $active =~ s/^.+?, (\d+)M active.+$/$1/; chomp $active; $active = $active * 1024 * 1024; $inactive =~ s/^.+?, (\d+)M inactive.+$/$1/; chomp $inactive; $inactive = $inactive * 1024 * 1024; $free =~ s/^.+?, (\d+)([M|K]) free.+$/$1/; chomp $free; $free = $free * 1024 * 1024; if ( $2 eq "K" ) { $free = $free / 1024; } - $used =~ s/^.+?, (\d+)M used.+$/$1/; chomp $used; $used = $used * 1024 * 1024; + $used =~ s/^.+?, (\d+)([M|G]) used.+$/$1/; chomp $used; $used = $used * 1024 * 1024; if ( $2 eq "G" ) { $used = $used * 1024; } print "wired.value " . $wired . "\n"; print "active.value " . $active . "\n"; print "inactive.value " . $inactive . "\n"; print "free.value " . $free . "\n"; print "used.value " . $used . "\n"; - $quit = 1; + $quit = 1; } }