X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Ftests%2Fleak_finder.pl;h=a7c7abb3b1e23d7225d7781cbd25aa32c3064739;hb=553d93361d2db4ff39bf19ac66dc2d79f6e3e324;hp=5219996d2515113fd7e61796fc32ccad0849a57b;hpb=c5050e412572b00cbe93d8517d2d1f767bebfa92;p=fs%2Flustre-release.git diff --git a/lustre/tests/leak_finder.pl b/lustre/tests/leak_finder.pl index 5219996..a7c7abb 100644 --- a/lustre/tests/leak_finder.pl +++ b/lustre/tests/leak_finder.pl @@ -11,10 +11,48 @@ my $debug_line = 0; my $total = 0; my $max = 0; -while ($line = <>) { +my @parsed; +my %cpu; +my $start_time = 0; + +if (!defined($ARGV[0])) { + print "No log file specified\n"; + exit +} + +open(INFILE, $ARGV[0]); +while ($line = ) { + if ($line =~ m/^(.*)\((.*):(\d+):(.*)\(\)\)/) { + @parsed = split(":", $1); + if (substr ($parsed[2], -1, 1) eq "F") { + chop $parsed[2]; + $cpu{$parsed[2]} = 0; + } else { + if (!defined($cpu{$parsed[2]})) { + $cpu{$parsed[2]} = $parsed[3]; + } + } + } +} + +foreach $time (values %cpu) { + if ($start_time < $time) { + $start_time = $time; + } +} + +print "Starting analysis since $start_time\n"; + +seek(INFILE, 0, 0); +while ($line = ) { $debug_line++; my ($file, $func, $lno, $name, $size, $addr, $type); - if ($line =~ m/^.*(\.).*\((.*):(\d+):(.*)\(\)\) (k|v|slab-)(.*) '(.*)': (\d+) at (.*) \(tot (.*)\).*$/){ + if ($line =~ m/^(.*)\((.*):(\d+):(.*)\(\)\) (k|v|slab-)(.*) '(.*)': (\d+) at ([\da-f]+)/){ + @parsed = split(":", $1); + if ($parsed[3] <= $start_time) { + next; + } + $file = $2; $lno = $3; $func = $4; @@ -22,7 +60,6 @@ while ($line = <>) { $name = $7; $size = $8; $addr = $9; - $tot = $10; # we can't dump the log after portals has exited, so skip "leaks" # from memory freed in the portals module unloading. @@ -69,11 +106,8 @@ while ($line = <>) { delete $memory->{$addr}; $total -= $size; } - if ($total != int($tot)) { - print "kernel total $tot != my total $total\n"; - $total = $tot; - } } +close(INFILE); # Sort leak output by allocation time my @sorted = sort {