diff options
author | Doug Freed <dwfreed@mtu.edu> | 2016-01-14 21:52:42 -0700 |
---|---|---|
committer | Doug Freed <dwfreed@mtu.edu> | 2016-01-14 21:52:42 -0700 |
commit | 2aa15f5a89ffeee2a1ee6d443afb8129ba644255 (patch) | |
tree | b75b3e0e1581e5b6649cb9300940179f306eac78 | |
parent | d8bccaa91a019b05309ef7de70796fa2337d395d (diff) | |
download | antispammeta-2aa15f5a89ffeee2a1ee6d443afb8129ba644255.tar.bz2 antispammeta-2aa15f5a89ffeee2a1ee6d443afb8129ba644255.tar.xz antispammeta-2aa15f5a89ffeee2a1ee6d443afb8129ba644255.tar.zst |
Fix ASM's memory usage display to be more accurate
-rw-r--r-- | lib/ASM/Commander.pm | 7 | ||||
-rw-r--r-- | lib/ASM/Event.pm | 7 |
2 files changed, 10 insertions, 4 deletions
diff --git a/lib/ASM/Commander.pm b/lib/ASM/Commander.pm index f53781f..9a28e3b 100644 --- a/lib/ASM/Commander.pm +++ b/lib/ASM/Commander.pm @@ -270,9 +270,12 @@ sub cmd_teredo { sub cmd_status { my ($conn, $event) = @_; - my $size = `ps -p $$ h -o size`; + my $size = `pmap -X $$ | tail -n 1`; + $size =~ s/^\s+|\s+$//g; + my @temp = split(/ +/, $size); + $size = $temp[1] + $temp[5]; my $cputime = `ps -p $$ h -o time`; - chomp $size; chomp $cputime; + chomp $cputime; my $upstr = ''; my $up = (time - $::starttime); if (int($up/86400) != 0) { #days diff --git a/lib/ASM/Event.pm b/lib/ASM/Event.pm index 4f0d547..9a8b826 100644 --- a/lib/ASM/Event.pm +++ b/lib/ASM/Event.pm @@ -907,9 +907,12 @@ sub on_quietlistend } $::pendingsync--; if ($::pendingsync == 0) { - my $size = `ps -p $$ h -o size`; + my $size = `pmap -X $$ | tail -n 1`; + $size =~ s/^\s+|\s+$//g; + my @temp = split(/ +/, $size); + $size = $temp[1] + $temp[5]; my $cputime = `ps -p $$ h -o time`; - chomp $size; chomp $cputime; + chomp $cputime; my ($tx, $rx); if ($conn->{_tx}/1024 > 1024) { $tx = sprintf("%.2fMB", $conn->{_tx}/(1024*1024)); |