Quote:
Originally Posted by peterleinchen
Yes, mee too.
My swap usage is increasing day by day. If I would not have extended size of swap on SD it would fill up completely (almost  ).
Thanks for investigating!
|
Just coded this (perl) on the way home. It checks every $INTERVAL seconds and reports changes (positive or negative, above $THRESHOLD) in the memory use (VSZ output from ps) of a list of daemons (edit the file to add/delete some more).
Initial version, it works, but there's a lot we can do starting from this:
Code:
#!/usr/bin/perl
use strict;
use warnings;
my @watch = (
"/sbin/dsme",
"/sbin/dsme-server",
"/usr/bin/pulseaudio",
"/usr/bin/Xorg",
"/usr/bin/dbus-daemon",
"/usr/bin/systemui",
"/usr/bin/hildon-status-menu",
"/usr/bin/hildon-home",
"/usr/bin/hildon-desktop",
"/usr/sbin/browserd"
);
my %initial = ();
# percentage VSZ has to change to report
my $THRESHOLD = 0.0;
# will check once every $INTERVAL seconds
my $INTERVAL = 4;
while(1) {
my %current = ();
open(FH, "ps -eo vsz,command |");
while(<FH>) {
chomp;
my @fields = split;
my $vsz = $fields[0];
my $cmd = $fields[1];
# print "vsz($vsz) cmd($cmd)\n";
foreach my $daemon (@watch) {
if($daemon eq $cmd) {
$current{$cmd} += $vsz;
}
}
}
if(%initial) {
foreach my $daemon (keys %current) {
my $vsz0 = $initial{$daemon};
my $vsz1 = $current{$daemon};
my $mvar = (100.0 *($vsz1 - $vsz0)) / $vsz0;
if(abs($mvar) > $THRESHOLD) {
my $sign = "+";
if($vsz1 < $vsz0) {
$sign = "-";
}
my $now = localtime;
print "[$now] $daemon, $vsz0 -> $vsz1 ($sign)\n";
}
}
# remove next line if absolute (from start) values are wanted
%initial = %current;
} else {
print "Initializing..\n";
%initial = %current;
}
close(FH);
sleep($INTERVAL);
}